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.


    Solution of intensity configurable vibrations.

    Pythonista
    3
    3
    970
    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.
    • Nyanki0427
      Nyanki0427 last edited by Nyanki0427

      The key is to use UIImpactFeedbackGenerator .

      My demo:

      import objc_util, time
      feedback = objc_util.ObjCClass('UIImpactFeedbackGenerator').new()
      feedback.initWithStyle(0)
      for I in range(0, 9):
          feedback.impactOccurred()
          time.sleep(0.1)
      

      This demo will generate "impact feedback" with rhythm.

      Another way is to use AudioToolbox.h C API. I learned from this topic, but I found another system sound IDs to perform different intensities.

      AudioServicesPlaySystemSound(1519);
      AudioServicesPlaySystemSound(1520);
      AudioServicesPlaySystemSound(1521);
      

      Where 1519 and 1520 are the same feedbacks when you use 3D touch, 1521 is a 3 combo light vibrate.

      william26445 1 Reply Last reply Reply Quote 0
      • william26445
        william26445 @Nyanki0427 last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • Nikolina
          Nikolina last edited by

          That worked for me as well!

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