I made a custom CustomView.xib . It is owned by CustomView.swift which subclasses NSView. Now I can easily reuse CustomView inside my Storyboard by just adding NSView and setting it's class to CustomView. The problem is that I have a button inside CustomView.xib and I want to present a popover MyPopoverViewController whenever it's clicked. I googled and found out that in order to present a popover I need to use method like:
presentViewController(viewController: NSViewController, asPopoverRelativeTo: NSRect, of: NSView, preferredEdge: NSRectEdge, behavior: NSPopover.Behavior)
The problem is that this method is only available from NSViewController. But I don't have one. I want to trigger popover from within NSView. What should I do now? It should be possible because NSAlert works everywhere and it doesn't even take any NSViewController as an argument. So there should be a way to present popover without ever having any NSViewController.