UIMenu vs UIContextMenuInteraction vs UIPointerInteraction
I'm trying to set up UIContextMenuInteraction in the same way as in Files or Pages app:
- (Long) tap anywhere in the blank space shows the black horizontal
UIMenu - Secondary (Right/Control) click with a pointer anywhere in the blank space shows context menu
See demo on the attached GIF below.
I'm able to set up UIContextMenuInteraction and in its UIContextMenuInteractionDelegate return the UIContextMenuConfiguration with items I want to show.
The same for the small black UIMenu, I could use UILongPressGestureRecognizer and show the menu using UIMenuController.shared.showMenu.
However, I'm not able to prevent UIContextMenuInteraction from triggering and showing the UITargetedPreview when long-pressing on a view and there seems to be now way of recognizing different UITouchTypes with the info provided to UIContextMenuInteractionDelegate.
I also could not find how to show the context menu programatically, without UIContextMenuInteraction. Is there a way to do that?
Question
How is this implemented in Files.app?
