Make the interruptible transition
Example: https://github.com/MainasuK/ChidoriMenu/tree/feature/interruptible
I'm not sure that's what you want.
Depends on the GIF in the README. The iOS system UIMenu:
- Tap button. The menu presenting with animation
- Tap overlay. The menu reverses the transition to dismissing.
- Tap the button again. The menu cancels dismissing and presenting.
So there must be a reuse or diff mechanism to using the same transitioning. Then just toggle the animator. Finally, call the transition context callback depends on the animator's position end or not. Because the interruptible transition needs marked finish when it's completed.
I toggle the animator when tapping the overlay. That still needs some work to make that feels like the UIMenu.
Demo: https://user-images.githubusercontent.com/7940186/119816568-6e477400-bf1f-11eb-9b61-5bbcf5c551f8.mp4
By the way. I'm finding a way to trigger the UIMenu display programmatically. Using the mouse with right-click on the iPad could trigger the menu display without the focus bubble.
So if could trigger right-click on the view likes this. The UIMenu could be revealing likes your repo.