Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Vibrate one time Taptic

How to make iPhone soft vibrate one time?
Below code vibrates twice.
Is there any way to check how many times vibrate occur in simulator? 🙂

let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.success) // .error .warning

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  1. You can’t test vibration on a simulator, Need to use a real device for checking vibrations.

  2. for soft vibration, you can use UISelectionFeedbackGenerator and can also use UIImpactFeedbackGenerator with soft style like this:

// UISelectionFeedbackGenerator

let generator = UISelectionFeedbackGenerator()
    generator.selectionChanged()

// UIImpactFeedbackGenerator

let feedbackGenerator = UIImpactFeedbackGenerator(style: .soft)
 feedbackGenerator.impactOccurred()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading