Easy way to trigger transient haptics on iOS 13 and up.
Based on Apple's sample code.
Create an instance of HapticEngine()
sometime before you need to use it.
When you need to trigger a tap call hapticEngine.playHapticTransient(intensity: Float, sharpness: Float)
, where intensity
and sharpness
are values between 0 and 1.