Class

NSWindow

The NSWindow class defines objects (known as windows) that manage and coordinate the windows an application displays on the screen.

Overview

A single NSWindow object corresponds to at most one onscreen window. The two principal functions of a window are to provide an area in which views can be placed and to accept and distribute, to the appropriate views, events the user instigates through actions with the mouse and keyboard.

Symbols

Creating Windows

init(contentViewController: NSViewController)

Creates a titled window that contains the specified content view controller.

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 contentView: NSView?

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

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: NSWindowCollectionBehavior

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)

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)

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.

Accessing Window Information

class func defaultDepthLimit()

Returns the default depth limit for instances of NSWindow.

var windowNumber: Int

The window number of the window’s window device.

class func windowNumbers(withOptions: NSWindowNumberListOptions)

Returns the window numbers for all visible windows satisfying the specified options.

func gState()

Returns the window’s graphics state object.

Deprecated
func canStoreColor()

Indicates whether the window has a depth limit that allows it to store color values.

Deprecated
var deviceDescription: [String : Any]

A dictionary containing information about the window’s resolution, such as color, depth, and so on.

var canBecomeVisibleWithoutLogin: Bool

A Boolean value that indicates whether the window can be displayed at the login window.

var sharingType: NSWindowSharingType

A Boolean value that indicates the level of access other processes have to the window’s content.

var backingType: NSBackingStoreType

The window’s backing store type.

var backingLocation: NSWindowBackingLocation

The location of the window’s backing store.

var preferredBackingLocation: NSWindowBackingLocation

A Boolean value that indicates the preferred location for the window’s backing store.

var isOneShot: Bool

A Boolean value that indicates whether the window device the window manages is freed when it’s removed from the screen list.

var depthLimit: NSWindowDepth

The depth limit of the window.

var hasDynamicDepthLimit: Bool

A Boolean value that indicates whether the window’s depth limit can change to match the depth of the screen it’s on.

Getting Layout Information

class func contentRect(forFrameRect: NSRect, styleMask: NSWindowStyleMask)

Returns the content rectangle used by a window with a given frame rectangle and window style.

class func frameRect(forContentRect: NSRect, styleMask: NSWindowStyleMask)

Returns the frame rectangle used by a window with a given content rectangle and window style.

class func minFrameWidth(withTitle: String, styleMask: NSWindowStyleMask)

Returns the minimum width a window’s frame rectangle must have for it to display a title, with a given window style.

func contentRect(forFrameRect: NSRect)

Returns the window’s content rectangle with a given frame rectangle.

func frameRect(forContentRect: NSRect)

Returns the window’s frame rectangle with a given content rectangle.

Managing Windows

var drawers: [NSDrawer]?

The collection of drawers associated with the window.

var windowController: NSWindowController?

The window’s window controller.

Managing Sheets

var attachedSheet: NSWindow?

The sheet attached to the window.

var isSheet: Bool

A Boolean value that indicates whether the window has ever run as a modal sheet.

func beginSheet(NSWindow, completionHandler: (NSModalResponse) -> Void)? = nil)

Starts a document-modal session and presents—or queues for presentation—a sheet.

func beginCriticalSheet(NSWindow, completionHandler: (NSModalResponse) -> Void)? = nil)

Starts a document-modal session and presents the specified critical sheet.

func endSheet(NSWindow)

Ends a document-modal session and dismisses the specified sheet.

func endSheet(NSWindow, returnCode: NSModalResponse)

Ends a document-modal session and dismisses the specified sheet.

var sheetParent: NSWindow?

The window to which the sheet is attached.

var sheets: [NSWindow]

An array of the sheets currently attached to the window.

Sizing Windows

var frame: NSRect

The window’s frame rectangle in screen coordinates, including the title bar.

func setFrameOrigin(NSPoint)

Positions the bottom-left corner of the window’s frame rectangle at a given point in screen coordinates.

func setFrameTopLeftPoint(NSPoint)

Positions the top-left corner of the window’s frame rectangle at a given point in screen coordinates.

func constrainFrameRect(NSRect, to: NSScreen?)

Modifies and returns a frame rectangle so that its top edge lies on a specific screen.

func cascadeTopLeft(from: NSPoint)

Positions the window's top left to a given point.

func setFrame(NSRect, display: Bool)

Sets the origin and size of the window’s frame rectangle according to a given frame rectangle, thereby setting its position and size onscreen.

func setFrame(NSRect, display: Bool, animate: Bool)

Sets the origin and size of the window’s frame rectangle, with optional animation, according to a given frame rectangle, thereby setting its position and size onscreen.

func animationResizeTime(NSRect)

Specifies the duration of a smooth frame-size change.

var aspectRatio: NSSize

The window’s aspect ratio, which constrains the size of its frame rectangle to integral multiples of this ratio when the user resizes it.

var minSize: NSSize

The minimum size to which the window’s frame (including its title bar) can be sized.

var maxSize: NSSize

The maximum size to which the window’s frame (including its title bar) can be sized.

var isZoomed: Bool

A Boolean value that indicates whether the window is in a zoomed state.

func performZoom(Any?)

This action method simulates the user clicking the zoom box by momentarily highlighting the button and then zooming the window.

func zoom(Any?)

This action method toggles the size and location of the window between its standard state (provided by the application as the “best” size to display the window’s data) and its user state (a new size and location the user may have set by moving or resizing the window).

var resizeFlags: Int

The flags field of the event record for the mouse-down event that initiated the resizing session.

var showsResizeIndicator: Bool

A Boolean value that indicates whether the window’s resize indicator is visible.

var resizeIncrements: NSSize

The window’s resizing increments.

var preservesContentDuringLiveResize: Bool

A Boolean value that indicates whether the window tries to optimize user-initiated resize operations by preserving the content of views that have not changed.

var inLiveResize: Bool

A Boolean value that indicates whether the window is being resized by the user.

Sizing Content

var contentAspectRatio: NSSize

The window’s content aspect ratio.

var contentMinSize: NSSize

The minimum size of the window’s content view in the window’s base coordinate system.

func setContentSize(NSSize)

Sets the size of the window’s content view to a given size, which is expressed in the window’s base coordinate system.

var contentMaxSize: NSSize

The maximum size of the window’s content view in the window’s base coordinate system.

var contentResizeIncrements: NSSize

The window’s content-view resizing increments.

var contentLayoutGuide: Any?

A value used by Auto Layout constraints to automatically bind to the value of contentLayoutRect.

var contentLayoutRect: NSRect

The area inside the window that is for non-obscured content, in window coordinates.

var maxFullScreenContentSize: NSSize

A maximum size that is used to determine if a window can fit when it is in full screen in a tile.

var minFullScreenContentSize: NSSize

A minimum size that is used to determine if a window can fit when it is in full screen in a tile.

Managing Window Layers

func orderOut(Any?)

Removes the window from the screen list, which hides the window.

func orderBack(Any?)

Moves the window to the back of its level in the screen list, without changing either the key window or the main window.

func orderFront(Any?)

Moves the window to the front of its level in the screen list, without changing either the key window or the main window.

func orderFrontRegardless()

Moves the window to the front of its level, even if its application isn’t active, without changing either the key window or the main window.

func order(NSWindowOrderingMode, relativeTo: Int)

Repositions the window’s window device in the window server’s screen list.

var level: Int

The window level of the window.

Managing Window Visibility and Occlusion State

var isVisible: Bool

A Boolean value that indicates whether the window is visible onscreen (even when it’s obscured by other windows).

var occlusionState: NSWindowOcclusionState

The occlusion state of the window.

Managing Window Frames in User Defaults

class func removeFrame(usingName: String)

Removes the frame data stored under a given name from the application’s user defaults.

func setFrameUsingName(String)

Sets the window’s frame rectangle by reading the rectangle data stored under a given name from the defaults system.

func setFrameUsingName(String, force: Bool)

Sets the window’s frame rectangle by reading the rectangle data stored under a given name from the defaults system. Can operate on non-resizable windows.

func saveFrame(usingName: String)

Saves the window’s frame rectangle in the user defaults system under a given name.

var frameAutosaveName: String

The name used to automatically save the window’s frame rectangle data in the defaults system.

var stringWithSavedFrame: String

A string representation of the window’s frame rectangle.

func setFrameFrom(String)

Sets the window’s frame rectangle from a given string representation.

Managing Key Status

var isKeyWindow: Bool

A Boolean value that indicates whether the window is the key window for the application.

var canBecomeKey: Bool

A Boolean value that indicates whether the window can become the key window.

func makeKey()

Makes the window the key window.

func makeKeyAndOrderFront(Any?)

Moves the window to the front of the screen list, within its level, and makes it the key window; that is, it shows the window.

func becomeKey()

Invoked automatically to inform the window that it has become the key window; never invoke this method directly.

func resignKey()

Invoked automatically when the window resigns key window status; never invoke this method directly.

Managing Main Status

var isMainWindow: Bool

A Boolean value that indicates whether the window is the application’s main window.

var canBecomeMain: Bool

A Boolean value that indicates whether the window can become the application’s main window.

func makeMain()

Makes the window the main window.

func becomeMain()

Invoked automatically to inform the window that it has become the main window; never invoke this method directly.

func resignMain()

Invoked automatically when the window resigns main window status; never invoke this method directly.

Managing Toolbars

var toolbar: NSToolbar?

The window’s toolbar.

func toggleToolbarShown(Any?)

The action method for the “Hide Toolbar” menu item (which alternates with “Show Toolbar”).

func runToolbarCustomizationPalette(Any?)

The action method for the “Customize Toolbar…” menu item.

Managing Attached Windows

var childWindows: [NSWindow]?

An array of the window’s attached child windows.

func addChildWindow(NSWindow, ordered: NSWindowOrderingMode)

Adds a given window as a child window of the window.

func removeChildWindow(NSWindow)

Detaches a given child window from the window.

var parent: NSWindow?

The parent window to which the window is attached as a child.

Managing Window Buffers

var isFlushWindowDisabled: Bool

A Boolean value that indicates whether the window’s flushing ability is disabled.

func enableFlushing()

Reenables the flush() method for the window after it was disabled through a previous disableFlushing() message.

func disableFlushing()

Disables the flush() method for the window.

func flush()

Flushes the window’s offscreen buffer to the screen if the window is buffered and flushing is enabled.

func flushIfNeeded()

Flushes the window’s offscreen buffer to the screen if flushing is enabled and if the last flush() message had no effect because flushing was disabled.

Managing Default Buttons

var defaultButtonCell: NSButtonCell?

The button cell that performs as if clicked when the window receives a Return (or Enter) key event.

func enableKeyEquivalentForDefaultButtonCell()

Reenables the default button cell’s key equivalent, so it performs a click when the user presses Return (or Enter).

func disableKeyEquivalentForDefaultButtonCell()

Disables the default button cell’s key equivalent, so it doesn’t perform a click when the user presses Return (or Enter).

Managing Field Editors

func fieldEditor(Bool, for: Any?)

Returns the window’s field editor, creating it if requested.

func endEditing(for: Any?)

Forces the field editor to give up its first responder status and prepares it for its next assignment.

Managing the Window Menu

var isExcludedFromWindowsMenu: Bool

A Boolean value that indicates whether the window is excluded from the application’s Windows menu.

Managing Cursor Rectangles

var areCursorRectsEnabled: Bool

A Boolean value that indicates whether the window’s cursor rectangles are enabled.

func enableCursorRects()

Reenables cursor rectangle management within the window after a disableCursorRects() message.

func disableCursorRects()

Disables all cursor rectangle management within the window.

func discardCursorRects()

Invalidates all cursor rectangles in the window.

func invalidateCursorRects(for: NSView)

Marks as invalid the cursor rectangles of a given NSView object in the window’s view hierarchy, so they’ll be set up again when the window becomes key (or immediately if the window is key).

func resetCursorRects()

Clears the window’s cursor rectangles and the cursor rectangles of the NSView objects in its view hierarchy.

Managing Title Bars

class func standardWindowButton(NSWindowButton, for: NSWindowStyleMask)

Returns a new instance of a given standard window button, sized appropriately for a given window style.

func standardWindowButton(NSWindowButton)

Returns the window button of a given window button kind in the window’s view hierarchy.

var showsToolbarButton: Bool

A Boolean value that indicates whether the toolbar control button is currently displayed.

var titlebarAppearsTransparent: Bool

A Boolean value that indicates whether the title bar draws its background.

Managing the Toolbar-Title Bar Area

func addTitlebarAccessoryViewController(NSTitlebarAccessoryViewController)

Adds the specified title bar accessory view controller to the window.

func insertTitlebarAccessoryViewController(NSTitlebarAccessoryViewController, at: Int)

Inserts the view controller into the window’s array of title bar accessory view controllers at the specified index.

func performDrag(with: NSEvent)

Starts a drag based on the specified mouse-down event.

func removeTitlebarAccessoryViewController(at: Int)

Removes the view controller at the specified index from the window’s array of title bar accessory view controllers.

var titlebarAccessoryViewControllers: [NSTitlebarAccessoryViewController]

An array of title bar accessory view controllers that are currently added to the window.

Managing Tooltips

var allowsToolTipsWhenApplicationIsInactive: Bool

A Boolean value that indicates whether the window can display tooltips even when the application is in the background.

Handling Events

class func menuChanged(NSMenu)

This method does nothing; it is here for backward compatibility.

Deprecated
var currentEvent: NSEvent?

The event currently being processed by the application.

func nextEvent(matching: NSEventMask)

Returns the next event matching a given mask.

func discardEvents(matching: NSEventMask, before: NSEvent?)

Forwards the message to the NSApplication object, NSApp.

func postEvent(NSEvent, atStart: Bool)

Forwards the message to the global NSApplication object, NSApp.

func sendEvent(NSEvent)

This action method dispatches mouse and keyboard events sent to the window by the NSApplication object.

func `try`(toPerform: Selector, with: Any?)

Dispatches action messages with a given argument.

Managing Responders

var initialFirstResponder: NSView?

The view that’s made first responder (also called the key view) the first time the window is placed onscreen.

var firstResponder: NSResponder

The window’s first responder.

func makeFirstResponder(NSResponder?)

Attempts to make a given responder the first responder for the window.

Managing the Key View Loop

func selectKeyView(preceding: NSView)

Makes key the view that precedes the given view.

func selectKeyView(following: NSView)

Makes key the view that follows the given view.

func selectPreviousKeyView(Any?)

This action method searches for a candidate previous key view and, if it finds one, invokes makeFirstResponder(_:) to establish it as the first responder.

func selectNextKeyView(Any?)

This action method searches for a candidate next key view and, if it finds one, invokes makeFirstResponder(_:) to establish it as the first responder.

var keyViewSelectionDirection: NSSelectionDirection

The direction the window is currently using to change the key view.

var autorecalculatesKeyViewLoop: Bool

A Boolean value that indicates whether the window automatically recalculates the key view loop when views are added.

func recalculateKeyViewLoop()

Marks the key view loop as dirty and in need of recalculation.

Handling Keyboard Events

func keyDown(with: NSEvent)

Handles a given keyboard event that may need to be interpreted as changing the key view or triggering a keyboard equivalent.

Handling Mouse Events

var acceptsMouseMovedEvents: Bool

A Boolean value that indicates whether the window accepts mouse-moved events.

var ignoresMouseEvents: Bool

A Boolean value that indicates whether the window is transparent to mouse events.

var mouseLocationOutsideOfEventStream: NSPoint

The current location of the pointer reckoned in the window’s base coordinate system, regardless of the current event being handled or of any events pending.

class func windowNumber(at: NSPoint, belowWindowWithWindowNumber: Int)

Returns the number of the frontmost window that would be hit by a mouse-down at the specified screen location.

func trackEvents(matching: NSEventMask, timeout: TimeInterval, mode: RunLoopMode, handler: (NSEvent, UnsafeMutablePointer<ObjCBool>) -> Void)

Tracks events that match the specified mask using the specified tracking handler until the tracking handler explicitly terminates tracking.

Handling Window Restoration

var isRestorable: Bool

A Boolean value indicating whether the window configuration is preserved between application launches.

var restorationClass: NSWindowRestoration.Type?

The restoration class associated with the window.

func disableSnapshotRestoration()

Disable snapshot restoration.

func enableSnapshotRestoration()

Enable snapshot restoration.

Bracketing Drawing Operations

func cacheImage(in: NSRect)

Stores the window’s raster image from a given rectangle expressed in the window’s base coordinate system.

func restoreCachedImage()

Splices the window’s cached image rectangles, if any, back into its raster image (and buffer if it has one), undoing the effect of any drawing performed within those areas since they were established using cacheImage(in:).

func discardCachedImage()

Discards all of the window’s cached image rectangles.

Drawing Windows

func display()

Passes a display message down the window’s view hierarchy, thus redrawing all views within the window, including the frame view that draws the border, title bar, and other peripheral elements.

func displayIfNeeded()

Passes a displayIfNeeded message down the window’s view hierarchy, thus redrawing all views that need to be displayed, including the frame view that draws the border, title bar, and other peripheral elements.

var viewsNeedDisplay: Bool

A Boolean value that indicates whether any of the window’s views need to be displayed.

var isAutodisplay: Bool

A Boolean value that indicates whether the window automatically displays views that need to be displayed.

func useOptimizedDrawing(Bool)

Specifies whether the window is to optimize focusing and drawing when displaying its views.

Deprecated
var graphicsContext: NSGraphicsContext?

The graphics context associated with the window for the current thread.

var allowsConcurrentViewDrawing: Bool

A Boolean value that indicates whether the window allows multithreaded view drawing.

Window Animation

var animationBehavior: NSWindowAnimationBehavior

The window’s automatic animation behavior.

Updating Windows

func disableScreenUpdatesUntilFlush()

Disables the window’s screen updates until the window is flushed.

func update()

Updates the window.

Dragging Items

func registerForDraggedTypes([String])

Registers a give set of pasteboard types as the pasteboard types the window will accept as the destination of an image-dragging session.

func unregisterDraggedTypes()

Unregisters the window as a possible destination for dragging operations.

Accessing Edited Status

var isDocumentEdited: Bool

A Boolean value that indicates whether the window’s document has been edited.

Converting Coordinates

var backingScaleFactor: CGFloat

The backing scale factor.

func backingAlignedRect(NSRect, options: AlignmentOptions = [])

Returns a backing store pixel aligned rectangle in window coordinates.

func convertFromBacking(NSRect)

Converts a rect from its pixel aligned backing store coordinate system to the window’s coordinate system.

func convertToBacking(NSRect)

Converts a rectangle from the window’s coordinate system to its pixel aligned backing store coordinate system.

func convertToScreen(NSRect)

Converts the rectangle to the screen coordinate system from the window’s coordinate system.

func convertFromScreen(NSRect)

Converts the rectangle from the screen coordinate system to the window’s coordinate system

Managing Titles

var title: String

The string that appears in the title bar of the window or the path to the represented file.

var titleVisibility: NSWindowTitleVisibility

A value that indicates the visibility of the window’s title and title bar buttons.

func setTitleWithRepresentedFilename(String)

Sets a given path as the window’s title, formatting it as a file-system path, and records this path as the window’s associated filename using representedFilename.

var representedFilename: String

The path to the file of the window’s represented file.

var representedURL: URL?

The URL of the file the window represents.

Accessing Screen Information

var screen: NSScreen?

The screen the window is on.

var deepestScreen: NSScreen?

The deepest screen the window is on (it may be split over several screens).

var displaysWhenScreenProfileChanges: Bool

A Boolean value that indicates whether the window context should be updated when the screen profile changes or when the window moves to a different screen.

Moving Windows

var isMovableByWindowBackground: Bool

A Boolean value that indicates whether the window is movable by clicking and dragging anywhere in its background.

var isMovable: Bool

A Boolean value that indicates whether the window can be dragged by clicking in its title bar or background.

func center()

Sets the window’s location to the center of the screen.

Closing Windows

func performClose(Any?)

This action method simulates the user clicking the close button by momentarily highlighting the button and then closing the window.

func close()

Removes the window from the screen.

var isReleasedWhenClosed: Bool

A Boolean value that indicates whether the window is released when it receives the close message.

Minimizing Windows

var isMiniaturized: Bool

A Boolean value that indicates whether the window is minimized.

func performMiniaturize(Any?)

Simulates the user clicking the minimize button by momentarily highlighting the button, then minimizing the window.

func miniaturize(Any?)

Removes the window from the screen list and displays the minimized window in the Dock.

func deminiaturize(Any?)

De-minimizes the window.

var miniwindowImage: NSImage?

The custom miniaturized window image of the window.

var miniwindowTitle: String!

The title displayed in the window’s minimized window.

Getting the Dock Tile

var dockTile: NSDockTile

The application’s Dock tile.

Printing Windows

func print(Any?)

This action method runs the Print panel, and if the user chooses an option other than canceling, prints the window (its frame view and all subviews).

func dataWithEPS(inside: NSRect)

Returns EPS data that draws the region of the window within a given rectangle.

func dataWithPDF(inside: NSRect)

Returns PDF data that draws the region of the window within a given rectangle.

Providing Services

func validRequestor(forSendType: String, returnType: String)

Searches for an object that responds to a Services request.

Triggering Constraint-Based Layout

func updateConstraintsIfNeeded()

Updates the constraints based on changes to views in the window since the last layout.

func layoutIfNeeded()

Updates the layout of views in the window based on the current views and constraints.

Debugging Constraint-Based Layout

See Cocoa Auto Layout Release Notes for more details on debugging constraint-based layout.

func visualizeConstraints([NSLayoutConstraint])

Displays a visual representation of the supplied constraints in the window.

Constraint-Based Layouts

func anchorAttribute(for: NSLayoutConstraintOrientation)

Returns which part of the window stays stationary during constraint based layout.

func setAnchorAttribute(NSLayoutAttribute, for: NSLayoutConstraintOrientation)

Sets which part of the window stays stationary during constrain based layout.

Working with Carbon

init?(windowRef: UnsafeMutableRawPointer)

Returns a Cocoa window created from a Carbon window.

var windowRef: UnsafeMutableRawPointer

The Carbon WindowRef associated with the window, creating one if necessary.

Constants

NSWindowStyleMask

These constants specify the style of a window, and can be combined using the C bitwise OR operator.

Display Device—Descriptions

These constants are the keys for device description dictionaries used by deviceDescription.

Managing Scaling Factors

Manages scaling factors.

NSSelectionDirection

These constants specify the direction a window is currently using to change the key view. They’re used by keyViewSelectionDirection.

NSWindowButton

These constants provide a way to access standard title bar buttons:

NSWindowDepth

This type represents the depth, or amount of memory, devoted to a single pixel in a window or screen. A depth of 0 indicates default depth. Window depths should not be made persistent as they will not be the same across systems.

Explicit Window Depth Limits

These constants define explicit window depths that can be used with depthLimit.

NSBackingStoreType

These constants specify how the drawing done in a window is buffered by the window device.

NSWindowOrderingMode

These constants let you specify how a window is ordered relative to another window. For more information, see order(_:relativeTo:).

NSWindowSharingType

The following constants and the related data type represent the access levels other processes can have to a window’s content.

NSWindowBackingLocation

The following constants and the related data type represent a window’s possible backing locations.

NSWindowNumberListOptions

The options that may be passed to the windowNumbers(withOptions:) method.

NSWindowAnimationBehavior

These constants control the automatic window animation behavior used when the orderFront(_:) or orderOut(_:) methods are called.

NSWindowCollectionBehavior

Window collection behaviors related to Exposé and Spaces.

NSWindowOcclusionState

Specifies whether the window is occluded.

NSWindowTitleVisibility

Specifies the appearance of the window’s title bar area.

Additional NSModalResponse Values

These constants specify values that can be returned by endSheet(_:) and by the completion handlers for beginSheet(_:completionHandler:) and beginCriticalSheet(_:completionHandler:).

Application Kit Version for Deferred Window Display Support

The version of the AppKit.framework containing a specific bug fix or capability.

Application Kit Version for Custom Sheet Position

The version of the AppKit.framework containing a specific bug fix or capability.

Notifications

static let NSWindowDidBecomeKey: NSNotification.Name

Posted whenever an NSWindow object becomes the key window.

static let NSWindowDidBecomeMain: NSNotification.Name

Posted whenever an NSWindow object becomes the main window.

static let NSWindowDidChangeScreen: NSNotification.Name

Posted whenever a portion of an NSWindow object’s frame moves onto or off of a screen.

static let NSWindowDidChangeScreenProfile: NSNotification.Name

Posted whenever the display profile for the screen containing the window changes.

static let NSWindowDidDeminiaturize: NSNotification.Name

Posted whenever an NSWindow object is deminimized.

static let NSWindowDidEndSheet: NSNotification.Name

Posted whenever an NSWindow object closes an attached sheet.

static let NSWindowDidEndLiveResize: NSNotification.Name

Posted after the user resizes a window.

static let NSWindowDidExpose: NSNotification.Name

Posted whenever a portion of a nonretained NSWindow object is exposed, whether by being ordered in front of other windows or by other windows being removed from in front of it.

static let NSWindowDidMiniaturize: NSNotification.Name

Posted whenever an NSWindow object is minimized.

static let NSWindowDidMove: NSNotification.Name

Posted whenever an NSWindow object is moved.

static let NSWindowDidResignKey: NSNotification.Name

Posted whenever an NSWindow object resigns its status as key window.

static let NSWindowDidResignMain: NSNotification.Name

Posted whenever an NSWindow object resigns its status as main window.

static let NSWindowDidResize: NSNotification.Name

Posted whenever an NSWindow object’s size changes.

static let NSWindowDidUpdate: NSNotification.Name

Posted whenever an NSWindow object receives an update() message.

static let NSWindowWillBeginSheet: NSNotification.Name

Posted whenever an NSWindow object is about to open a sheet.

static let NSWindowWillClose: NSNotification.Name

Posted whenever an NSWindow object is about to close.

static let NSWindowWillMiniaturize: NSNotification.Name

Posted whenever an NSWindow object is about to be minimized.

static let NSWindowWillMove: NSNotification.Name

Posted whenever an NSWindow object is about to move.

static let NSWindowWillStartLiveResize: NSNotification.Name

Posted before the user resizes a window.

static let NSWindowWillEnterFullScreen: NSNotification.Name

Posted when the window will enter full screen mode.

static let NSWindowDidEnterFullScreen: NSNotification.Name

Posted when the window entered full screen mode.

static let NSWindowWillExitFullScreen: NSNotification.Name

Posted when the window will exit full screen mode.

static let NSWindowDidExitFullScreen: NSNotification.Name

Posted when the window did exit full screen mode.

static let NSWindowWillEnterVersionBrowser: NSNotification.Name

Posted when the window will enter version browser mode.

static let NSWindowDidEnterVersionBrowser: NSNotification.Name

Posted when the window will enter version browser mode.

static let NSWindowWillExitVersionBrowser: NSNotification.Name

Posted when the window will exit version browser mode.

static let NSWindowDidExitVersionBrowser: NSNotification.Name

Posted when the window did exit version browser mode.

static let NSWindowDidChangeBackingProperties: NSNotification.Name

Posted when the window backing properties change.

static let NSWindowDidChangeOcclusionState: NSNotification.Name

Posted when the window’s occlusion state changes.

Instance Properties

var isFloatingPanel: Bool
var hasCloseBox: Bool

Returns true if the receiver has a close box.

var hasTitleBar: Bool

Returns true if the receiver has a title bar.

var isMiniaturizable: Boolvar isModalPanel: Bool
var orderedIndex: Int

Sets the zero-based position of the receiver, based on its order from front to back among all visible application windows, to the value specified by index. If index is out of range, sets the position to the nearest value that is in range.

var isResizable: Boolvar styleMask: NSWindowStyleMaskvar tabbedWindows: [NSWindow]?var tabbingIdentifier: Stringvar tabbingMode: NSWindowTabbingModevar windowTitlebarLayoutDirection: NSUserInterfaceLayoutDirectionvar isZoomable: Bool

Instance Methods

func addTabbedWindow(NSWindow, ordered: NSWindowOrderingMode)func canRepresent(NSDisplayGamut)
func handleClose(NSCloseCommand)

Handles the close AppleScript command by attempting to close the window (and its associated document, if any).

func handlePrint(NSScriptCommand)

Handles the print AppleScript command by attempting to print the contents of the window (or its associated document, if any).

func handleSave(NSScriptCommand)

Handles the save AppleScript command by attempting to save the window (and its associated document, if any).

func mergeAllWindows(Any?)func moveTabToNewWindow(Any?)func selectNextTab(Any?)func selectPreviousTab(Any?)func setDynamicDepthLimit(Bool)func setFrameAutosaveName(String)
func setIsMiniaturized(Bool)

Sets the receiver’s miniaturized state to the value specified by flag.

func setIsVisible(Bool)

Sets the receiver’s visible state to the value specified by flag.

func setIsZoomed(Bool)

Sets the receiver’s zoomed state to the value specified by flag.

func toggleTabBar(Any?)