Giter Site home page Giter Site logo

taptickit's Introduction

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

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'TapticKit'
end

Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

$ pod install

Add this to Cartfile

github "devandsev/TapticKit"

In the Cartfile directory, type:

$ carthage update

Usage examples

As Apple recommends

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.

All available feedback types:

TapticKit.trigger(.notification(.success))
TapticKit.trigger(.notification(.error))
TapticKit.trigger(.notification(.warning))

TapticKit.trigger(.selection)

TapticKit.trigger(.impact(.light))
TapticKit.trigger(.impact(.medium))
TapticKit.trigger(.impact(.heavy))

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.