Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
  • Overview
  • Transcript

2.2 Providing Haptic Feedback

With the removal of a physical home button on the iPhone 7, the way apps provide feedback has changed. In this lesson, I’ll teach you how to provide the correct haptic feedback in your app.

Related Links

2.2 Providing Haptic Feedback

Hi and welcome back to What's new in iOS 10. In this lesson, I will teach you how to use haptic feedback in your application. With the iPhone 7, applicant rid of a physical home button and instead replace that with the haptic feedback engine that simulates the button press with other operation. You can use this feedback mechanisms within your app as well. The haptic feedback API is very simple. But there are actually three ways to provide feedback, all of them follow the same process. First, you need to create a feedbackGenerator. I'm going to start with UIImpactFeedbackGenerator. It allows you to choose a style which can be light, medium or heavy. And defines the strength of feedback it generates. The impact feedback is just a single vibration, realize you know something happened like you scroll to the top of the list. After you initialize the feedbackGenerator, you just need to call impactOccured, which will create the haptic feedback. If you're having latency issues with the feedback generator, you can call prepare on it after you initialized it. So the feedback will be generated faster. Another way of providing feedback is the notification feedback generator which Apple uses heavily in iOS 10. You have three different notification types at your disposal as all generate different vibration patterns. Your feedback can either be a success, error or warning. It is important that you provide the correct semantic notification even if you think that a certain pattern feels better. Because users become accustomed to the meaning of those patterns throughout the system. The last feedback generator is the UISelectionFeedbackGenerator. Semantically, it signals the change of selection to the user. For example, when you select a photo in an image gallery. Of course, you can test haptic feedback in the simulator. You really need an actual iPhone 7 of 7 Plus for this. When you press the Generate Haptic Feedback button in our sample app, it will do nothing. Haptic feedback can have a great impact on how your users experience your app, and misusing it can lead to a lot of confusion. You can find more information in the Apple Human Interface Guidelines about that. In the next lesson, we are going to look at SiriKit and how you can start a conversation with their users. See you there.

Back to the top