swiftswiftuiwatchkitwatchos

How do I access the watchOS 10 double tap and other accessibility gestures


I would like to trigger parts of my app with the watchOS 10 double tap or other accessibility gestures that were introduced in older watchOS versions.

I tried to use the normal SwiftUI gesture recognition or the WKGestureRecognizer but both don't seem to support the wanted double tap with the fingers.


Solution

  • On Apple Watch Series 9 and Apple Watch Ultra 2, people can trigger a scene’s primary action by tapping their index finger and thumb together twice. In watchOS 11 and later, you can assign control, such as a Button or Toggle as the scene’s primary action, customizing how your app responds to double tap. https://developer.apple.com/documentation/watchos-apps/enabling-double-tap

    Button ("Start Activity") {
        startActivity = true
    }
    // Set this button as the primary action for double tap.
    .handGestureShortcut(.primaryAction)