Reputation: 6487
If I have AVAudioSession configured with .playAndRecord category and a remote IO unit running, what's the besy way to enable haptic feedback on button presses?
Upvotes: 0
Views: 54
Reputation: 2223
You can use UIFeedbackGenerator
to create haptic feedback in your iOS app. You can use one of the below options depends on your requirement:
UIImpactFeedbackGenerator: Use impact feedback generators to indicate that an impact has occurred. For example, you might trigger impact feedback when a user interface object collides with something or snaps into place.
Example:
let impact = UIImpactFeedbackGenerator()
impact.impactOccurred()
UISelectionFeedbackGenerator. Use selection feedback generators to indicate a change in selection.
Example:
let impact = UISelectionFeedbackGenerator()
impact.selectionChanged()
UINotificationFeedbackGenerator. Use notification feedback generators to indicate successes, failures, and warnings.
Example:
let impact = UINotificationFeedbackGenerator()
impact.notificationOccurred(.success)
You can read more info here: https://developer.apple.com/documentation/uikit/uifeedbackgenerator
Upvotes: 0