Vibrate using iOS haptics engine on supported devices #60397
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR uses the
CHHapticEngine
(https://developer.apple.com/documentation/corehaptics) API on iOS devices with iOS 13+ for vibration, making it possible to play vibration patterns of arbitrary length like on Android. Currently, it is not possible to play a vibration with a specific length on iOS.Additionally, this PR exposes methods to query Haptic Engine support and to manually start and stop the Haptic Engine instance. This is useful in applications where there must not be any latency when playing the first vibration. By default, the Haptic Engine instance is set to automatically start and stop on demand, which could induce a minimal delay on the first vibration according to the docs.