I am wondering how we could check if the new iOS 10 API UIFeebackGenerator
is available on the current device. There are some more things we would need to check
I made an extension to UIDevice
without using the private API
extension UIDevice {
static var isHapticsSupported : Bool {
let feedback = UIImpactFeedbackGenerator(style: .heavy)
feedback.prepare()
return feedback.description.hasSuffix("Heavy>")
}
} and you use it like this :
UIDevice.isHapticsSupported
returns true
or false