TapticKit makes it easier to use Taptic engine for haptic feedback. Supports all generations of Taptic engine. If the device doesn’t support the latest feedback types, TapticKit falls back on using older ones as substitutes.
Preparing the generator can reduce latency when triggering feedback. This is particularly important when trying to match feedback to sound or visual cues. Calling the generator’s prepare() method puts the Taptic Engine in a prepared state. To preserve power, the Taptic Engine stays in this state for only a short period of time (on the order of seconds), or until you next trigger feedback.
TapticKit.prepare(for: .notification(.success))
Then you can trigger your feedback:
TapticKit.trigger(.notification(.success))
Finally, you can release engine, this lets the Taptic Engine return to its idle state. It is optional.
TapticKit.release()
Though it’s recommended to prepare before you trigger an event and to release the engine aftewards, you don’t have to, if latency is not critical.
TapticKit
TapticKit makes it easier to use Taptic engine for haptic feedback. Supports all generations of Taptic engine. If the device doesn’t support the latest feedback types, TapticKit falls back on using older ones as substitutes.
Installation
CocoaPods
Replace
YOUR_TARGET_NAME
and then, in thePodfile
directory, type:Carthage
Add this to
Cartfile
In the
Cartfile
directory, type:Usage examples
As Apple recommends
Then you can trigger your feedback:
Finally, you can release engine, this lets the Taptic Engine return to its idle state. It is optional.
Though it’s recommended to prepare before you trigger an event and to release the engine aftewards, you don’t have to, if latency is not critical.
All available feedback types:
License
This project is licensed under the MIT License - see the LICENSE file for details.