INNER CODE UNIT · Swift
contextMenuInteraction
AfalpHy/sylvakru · ios/Runner/AppDelegate.swift:189
func contextMenuInteraction(
_ interaction: UIContextMenuInteraction,
configurationForMenuAtLocation location: CGPoint
) -> UIContextMenuConfiguration? {
// Smart Routing: Trigger context menu only if the physical long-press coordinate falls within the active Flutter Widget bounds.
// If coordinates mismatch or no actions available, return nil to pass gestures back to Flutter.
guard !self.currentMenuActions.isEmpty, self.currentMenuRect.contains(location) else {
return nil
}
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) {
[weak self] (suggestedActions) -> UIMenu? in
guard let self = self else { return UIMenu(title: "", children: []) }
// Core Logic for Menu Dividers
var topLevelElements: [UIMenuElement] = []
var currentGroupActions: [UIAction] = []