Forum Archive

Accessing the taptic engine

Seanz1207

After some research, I found a way to play the "peek" and "pop" taptic engine effects. This is tested on my iPhone 6s. See code below. Hope it helps.

from objc_util import * 

UIDevice = ObjCClass('UIDevice')

def taptic_peek():
    d = UIDevice.new()
    t = d._tapticEngine()
    t.actuateFeedback_(1001)   # or t.actuateFeedback_(0)

def taptic_pop():
    d = UIDevice.new()
    t = d._tapticEngine()
    t.actuateFeedback_(1002)   # or t.actuateFeedback_(1)

def taptic_triple_knock():
    d = UIDevice.new()
    t = d._tapticEngine()
    t.actuateFeedback_(2)

See here: http://stackoverflow.com/questions/32526868/taptic-in-ios-9

Some update:

On my iPhone 6s with iOS 10, actuateFeedback_(0) seems to give the same result as actuateFeedback_(1001), and actuateFeedback_(1) the same as actuateFeedback_(1002).
Also, I found that actuateFeedback_(2) gives the quick triple knock you get when you flip the vibrate/ring switch. Code has been updated above.

omz

Very nice!

mithrendal

I like this too. 🤗