You can pass the .escape AccessibilityActionKind to the accessibilityAction(::) modifier, to implement the perform escape gesture in SwiftUI.

A reminder of how perform escape works:

https://x.com/dadederk/status/1549066893377830913?s=20&t=Aog7ojR4E4eG4M3hd-cn3w

You may also find interesting...

In SwiftUI you won't find the .notEnabled accessibility trait. Instead, you can just configure a view as such with .disabled(true), and pass false to enable it. VoiceOver will announce it as "dimmed". https://developer.apple.com/documentation/swiftui/view/disabled(_:)

Looking at how to implement the magic tap in SwiftUI? There is an accessibilityAction(_:_:) with an action kind parameter, you can pass .magicTap, and a closure to handle that action. A reminder of what the magic tap is: https://x.com/dadederk/status/1548791545800888322?s=20&t=ZakzzXNfLk0-2kpYqD5v3A

If, for some reason, you are creating a button from scratch, instead of relying on UIButton (perhaps you are adding a fancy micro interaction animation?), take into account that you’ll need to configure the button accessibility trait.

Created in Swift with Ignite.

Supporting Swift for Swifts