Class

NSDrawer

An NSDrawer object is a user interface element that contains and displays view objects including NSTextView, NSScrollView, NSBrowser, and other classes that inherit from NSView. A drawer is associated with a window, called its parent, and can appear only while its parent is visible onscreen. A drawer cannot be moved or ordered independently of a window, but is instead attached to one edge of its parent and moves along with it.

Symbols

Creating Drawers

init(contentSize: NSSize, preferredEdge: NSRectEdge)

Creates a new drawer with the given size on the specified edge of the parent window.

var delegate: NSDrawerDelegate?

The receiver’s delegate.

Opening and Closing Drawers

func close()

If the receiver is open, this method closes it.

func close(Any?)

An action method to close the receiver.

func open()

If the receiver is closed, this method opens it.

func open(Any?)

An action method to open the drawer.

func open(on: NSRectEdge)

Causes the receiver to open on the specified edge of the parent window.

func toggle(Any?)

Toggles the drawer open or closed.

var state: Int

The state of the receiver.

Managing Drawer Size

var contentSize: NSSize

The size of the receiver’s content area.

var leadingOffset: CGFloat

The receiver’s leading offset.

var maxContentSize: NSSize

The maximum allowed size of the receiver’s content area.

var minContentSize: NSSize

The minimum allowed size of the receiver’s content area.

var trailingOffset: CGFloat

The receiver’s trailing offset.

Managing Drawer Edges

var edge: NSRectEdge

The edge of the window that the receiver is connected to.

var preferredEdge: NSRectEdge

The receiver’s preferred, or default, edge.

Managing Drawer Views

var contentView: NSView?

The receiver’s content view.

var parentWindow: NSWindow?

The receiver’s parent window.

Constants

NSDrawerState

These constants specify the possible states of a drawer.

Notifications

static let NSDrawerDidClose: NSNotification.Name

Posted whenever the drawer is closed.

static let NSDrawerDidOpen: NSNotification.Name

Posted whenever the drawer is opened.

static let NSDrawerWillClose: NSNotification.Name

Posted whenever the drawer is about to close.

static let NSDrawerWillOpen: NSNotification.Name

Posted whenever the drawer is about to open.