There is an undocumented "private thing":
UIDevice.currentDevice().valueForKey("_feedbackSupportLevel");
it returns 2 for tactile feedback devices - the iPhone 7/7 +, so you can easily use this to generate Haptic feedback:
let generator = UIImpactFeedbackGenerator(style: .heavy) generator.prepare() generator.impactOccurred()
returns 1 for iPhone 6S, here is the reserve for creating taptic:
import AudioToolbox AudioServicesPlaySystemSound(1519) // Actuate `Peek` feedback (weak boom) AudioServicesPlaySystemSound(1520) // Actuate `Pop` feedback (strong boom) AudioServicesPlaySystemSound(1521) // Actuate `Nope` feedback (series of three weak booms)
and returns 0 for iPhone 6 or older devices. Since this is a kind of undocumented thing, it can block you at the review stage, although I managed to pass the test and send the application with such a check.
More details: http://www.mikitamanko.com/blog/2017/01/29/haptic-feedback-with-uifeedbackgenerator/
Mikita manko
source share