A means to display additional content related to existing content on the screen.


The popover is positioned relative to the existing content and an anchor is used to express the relation between these two units of content. A popover has an appearance that specifies its visual characteristics, as well as a behavior that determines which user interactions will cause the popover to close. A transient popover is closed in response to most user interactions, whereas a semi-transient popovers is closed when the user interacts with the window containing the popover's positioning view. Popovers with application-defined behavior are not usually closed on the developer's behalf.

The system automatically positions each popover relative to its positioning view and moves the popover whenever its positioning view moves. A positioning rectangle within the positioning view can be specified for additional granularity.

Popovers can be detached to become a separate window when they are dragged by implementing the appropriate delegate method.


Popover’s Content View Control

var contentViewController: NSViewController?

The view controller that manages the content of the popover.

Popover Position and Size

var behavior: NSPopover.Behavior

Specifies the behavior of the popover.

func show(relativeTo: NSRect, of: NSView, preferredEdge: NSRectEdge)

Shows the popover anchored to the specified view.

var positioningRect: NSRect

The content size of the popover.

Popover Appearance

var appearance: NSAppearance?

The appearance of the popover.

var animates: Bool

Specifies if the popover is to be animated.

var contentSize: NSSize

The content size of the popover.

var isShown: Bool

The display state of the popover.

Closing a Popover

func performClose(Any?)

Attempts to close the popover.

func close()

Forces the popover to close without consulting its delegate.

Getting and Setting the Delegate

var delegate: NSPopoverDelegate?

The delegate of the popover.


enum NSPopover.Appearance

The set of predefined appearances for a popover.

enum NSPopover.Behavior

The appearance and disappearance behavior of a popover.

Notification User Info Keys

The following constants are used as keys in the userInfo dictionary for notifications pertaining to popovers.


class let didShowNotification: NSNotification.Name

Sent after the popover has finished animating onscreen.

class let didCloseNotification: NSNotification.Name

Sent after the popover has finished animating offscreen.

See Also


protocol NSPopoverDelegate

A set of optional methods that a popover delegate can implement to provide additional or custom functionality.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software