Fergus Hewson
09/23/2024, 4:24 AMval style = when (vibration) {
Heavy, HeavyX2, HeavyX3 -> UIImpactFeedbackStyle.UIImpactFeedbackStyleHeavy
Medium, MediumX2, MediumX3 -> UIImpactFeedbackStyle.UIImpactFeedbackStyleMedium
Rigid, RigidX2, RigidX3 -> UIImpactFeedbackStyle.UIImpactFeedbackStyleRigid
Light, LightX2, LightX3 -> UIImpactFeedbackStyle.UIImpactFeedbackStyleLight
Soft, SoftX2, SoftX3 -> UIImpactFeedbackStyle.UIImpactFeedbackStyleSoft
None -> return
}
val generator = UIImpactFeedbackGenerator(style)
repeat(vibration.repeat) {
generator.impactOccurred()
delay(BEEP_VIBRATION_DELAY)
}
Is there a better way of invoking vibrations on iOS from kotlin?