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...

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

In SwiftUI there is a very useful modifier accessibilityElement(children:), that will do very different things depending on the AccessibilityChildBehavior passed as a parameter. There are three options: ignore (default), contain, and combine.

All the accessibility capabilities you can check for, have counterpart notification names you can observe in case the user changes its preferences while using your app. https://x.com/dadederk/status/1577435144129892352

Created in Swift with Ignite.

Supporting Swift for Swifts