omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Accessing the taptic engine

    Pythonista
    3
    3
    2975
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Seanz1207
      Seanz1207 last edited by 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.

      1 Reply Last reply Reply Quote 2
      • omz
        omz last edited by

        Very nice!

        1 Reply Last reply Reply Quote 0
        • mithrendal
          mithrendal last edited by

          I like this too. 🤗

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors