Instance Property

contentView

The window’s content view, the highest accessible NSView object in the window’s view hierarchy.

Declaration

var contentView: NSView? { get set }

Discussion

The window retains the new content view and owns it thereafter. The view object is resized to fit precisely within the content area of the window. You can modify the content view’s coordinate system through its bounds rectangle, but can’t alter its frame rectangle (that is, its size or location) directly.

Setting this property causes the old content view to be released; if you plan to reuse it, be sure to retain it before changing the property value and to release it as appropriate when adding it to another NSWindow or NSView object.

See Also

Configuring Windows

func toggleFullScreen(Any?)

Takes the window into or out of fullscreen mode,

var worksWhenModal: Bool

A Boolean value that indicates whether the window is able to receive keyboard and mouse events even when some other window is being run modally.

var alphaValue: CGFloat

The window’s alpha value.

var backgroundColor: NSColor!

The color of the window’s background.

var colorSpace: NSColorSpace?

The window’s color space.

var contentViewController: NSViewController?

The main content view controller for the window.

var canHide: Bool

A Boolean value that indicates whether the window can be hidden when its application becomes hidden (during execution of the NSApplicationhide(_:) method).

var isOnActiveSpace: Bool

A Boolean value that indicates whether the window is on the currently active space.

var hidesOnDeactivate: Bool

A Boolean value that indicates whether the window is removed from the screen when its application becomes inactive.

var collectionBehavior: NSWindow.CollectionBehavior

A value that identifies the window’s behavior in window collections.

var isOpaque: Bool

A Boolean value that indicates whether the window is opaque.

var hasShadow: Bool

A Boolean value that indicates whether the window has a shadow.

func invalidateShadow()

Invalidates the window shadow so that it is recomputed based on the current window shape.

func autorecalculatesContentBorderThickness(for: NSRectEdge) -> Bool

Indicates whether the window calculates the thickness of a given border automatically.

func setAutorecalculatesContentBorderThickness(Bool, for: NSRectEdge)

Specifies whether the window calculates the thickness of a given border automatically.

func contentBorderThickness(for: NSRectEdge) -> CGFloat

Indicates the thickness of a given border of the window.

func setContentBorderThickness(CGFloat, for: NSRectEdge)

Specifies the thickness of a given border of the window.

var delegate: NSWindowDelegate?

The window’s delegate.

var preventsApplicationTerminationWhenModal: Bool

A Boolean value that indicates whether the window prevents application termination when modal.