Hey, I'm working on vibration for part of an app ...
# ios
f
Hey, I'm working on vibration for part of an app and am pretty underwhelmed when using the UIImpactGenerator, they are very weak or not present at all with the Soft/Light options. Here is what I'm doing.
val 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?