Post

Replies

Boosts

Views

Created

Check if NSViewController is presented as Popover
Hi,I'm trying to figure out how an NSViewController can check if it was presented as a popvoer, so it might by notification and delegate pattern inform observers and let delegate act upon disappearing of the popover by overriding viewWillDisappear method.So far I've with this solution:- (BOOL)isPresentedAsPopover { id popoverFrameClass = NSClassFromString(@"NSPopoverFrame"); id ourSuperViewClass = [[[self view] superview] class]; return [ourSuperViewClass isEqualTo:popoverFrameClass]; }I've found that when a NSViewController is presented as popover programmatically via presentViewController:asPopoverRelativeToRect:ofView:preferredEdge:behavior: method its view gets embedded in a NSPopoverFrame class view.Which seems to be part of a class cluster pattern, hence it's a private class. I don't like this kind of solution, knowing that in future this could change etc.Is there a better way to do that, rather than setting boolean property value in the View Controller when presenting it programmatically as a popover?
Topic: UI Frameworks SubTopic: AppKit Tags:
3
0
1.6k
Dec ’16
Swift Package and AsyncSequence
Hi, I'd like to start playing around with the new Swift Concurrency framework in a Swift Package, but I cannot use AsyncSequence. AsyncSequence is not available despite I'm using swift-tools-version:5.5 in my package manifest.
Replies
0
Boosts
0
Views
608
Activity
Oct ’21
Check if NSViewController is presented as Popover
Hi,I'm trying to figure out how an NSViewController can check if it was presented as a popvoer, so it might by notification and delegate pattern inform observers and let delegate act upon disappearing of the popover by overriding viewWillDisappear method.So far I've with this solution:- (BOOL)isPresentedAsPopover { id popoverFrameClass = NSClassFromString(@"NSPopoverFrame"); id ourSuperViewClass = [[[self view] superview] class]; return [ourSuperViewClass isEqualTo:popoverFrameClass]; }I've found that when a NSViewController is presented as popover programmatically via presentViewController:asPopoverRelativeToRect:ofView:preferredEdge:behavior: method its view gets embedded in a NSPopoverFrame class view.Which seems to be part of a class cluster pattern, hence it's a private class. I don't like this kind of solution, knowing that in future this could change etc.Is there a better way to do that, rather than setting boolean property value in the View Controller when presenting it programmatically as a popover?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
3
Boosts
0
Views
1.6k
Activity
Dec ’16