VoiceOver has a very cool gesture called the Magic Tap (double tap with two fingers). It should execute the most important task for the current state of the app. Examples: start/stop timer, play/pause music, take a photo, compose a tweet...

The twitter app is open. It doesn't matter where the focus is, if I double tap with two fingers, the compose tweet screen will be presented. Presumably Twitter is overriding the function accessibilityPerformMagicTap and executing the code that presents that screen and then returning true.

You just need to override accessibilityPerformMagicTap() to capture that gesture, execute the desired code, and return true if handled successfully.

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