To capture the gesture, you can override the accessibilityPerformEscape() function. In there you can dismiss your view, and return true if you could successfully handle it.

https://developer.apple.com/documentation/objectivec/nsobject-swift.class/accessibilityperformescape()