Mac Developer Library


AppKit Framework Reference NSPopoverDelegate Protocol Reference

Deployment Target:

On This Page


The NSPopoverDelegate protocol defines optional methods that can be implemented by an NSPopover delegate class to provide additional or custom functionality.

See NSPopover Class Reference for more information on popovers in general.

  • Detaches the popover creating a window containing the content.



    optional func detachableWindowForPopover(_ popover: NSPopover) -> NSWindow?


    - (NSWindow *)detachableWindowForPopover:(NSPopover *)popover



    The popover.

    Return Value

    Returns a window instance to which the popover should be detached.


    You should not remove the popover's content view as part of your implementation of this method.

    The popover and the detachable window may be shown at the same time and therefore cannot share a content view or content view controller.

    If the popover and the detachable window should have the same content, you should define the content in a separate nib file and use a view controller to instantiate separate copies of the content for the popover and the detachable window.

    The popover will animate to appear as though it morphs into the detachable window (unless the popover’s animates property is set to NOfalse). The exact animation used is not guaranteed.

    If there is no delegate, the delegate does not implement this method, or the delegate returns nil, the popup will not be displayed detached.


    Available in OS X v10.7 and later.