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