Popovers icon indicating copy to clipboard operation
Popovers copied to clipboard

SwiftUI Menu fails inside popover

Open aehlke opened this issue 1 year ago • 2 comments

Because of this project's change in January to remove the view controller container for popovers, Menu fails inside popovers with this error (for my project):

2022-12-06 13:49:31.731374+0900 ManabiReader[10408:14471610] [Assert] Failed to find a presenting view controller for view (<_TtGC7SwiftUIP10$1132ad86417ViewBasedUIButtonGVS_23ResolvedButtonStyleBodyVS_P10$113252bfc25BorderlessButtonStyleBase__: 0x14354dc20; baseClass = UIButton; frame = (0 0; 136.5 20.5); opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x600001288900>; layer = <CALayer: 0x600001cb6e00>>) in window (<UIWindow: 0x143807ed0; frame = (0 0; 834 1194); autoresize = W+H; gestureRecognizers = <NSArray: 0x6000012233f0>; layer = <UIWindowLayer: 0x600001223270>>). The interaction's view (or an ancestor) must have an associated view controller for presentation to work.

I'd prefer to use the native SwiftUI Menu instead of Popovers for the dropdown menu, because it satisfies my needs, but at least I have a workaround available. I'm also worried about what other things might fail in the future that I might want to use from within the popover.

edit: Native SwiftUI Alert also fails, but silently (it worked previously from within a native SwiftUI popover). Likewise with .sheet

aehlke avatar Dec 06 '22 05:12 aehlke