Haptic Feedback
iOS Haptic Feedback for iPhone 6s, 7 (or newer)
On iPhone 7 (or newer).
let selectionFeedbackGenerator = UISelectionFeedbackGenerator() selectionFeedbackGenerator.prepare() selectionFeedbackGenerator.selectionChanged()
On iPhone 6s (via work-around)
import AudioToolbox AudioServicesPlaySystemSound(1519) AudioServicesPlaySystemSound(1520) AudioServicesPlaySystemSound(1521) AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
if (@available(iOS 10.0, *))
{
UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle: UIImpactFeedbackStyleHeavy];
[generator prepare];
[generator impactOccurred];
}
Last updated
Was this helpful?