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

Configuring Windows

func toggle​Full​Screen(Any?)

Takes the window into or out of fullscreen mode,

var works​When​Modal:​ 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 alpha​Value:​ CGFloat

The window’s alpha value.

var background​Color:​ NSColor!

The color of the window’s background.

var color​Space:​ NSColor​Space?

The window’s color space.

var content​View:​ NSView?

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

var content​View​Controller:​ NSView​Controller?

The main content view controller for the window.

var can​Hide:​ Bool

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

var is​On​Active​Space:​ Bool

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

var hides​On​Deactivate:​ Bool

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

var collection​Behavior:​ NSWindow​Collection​Behavior

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

var is​Opaque:​ Bool

A Boolean value that indicates whether the window is opaque.

var has​Shadow:​ Bool

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

func invalidate​Shadow()

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

func autorecalculates​Content​Border​Thickness(for:​ NSRect​Edge)

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

func set​Autorecalculates​Content​Border​Thickness(Bool, for:​ NSRect​Edge)

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

func content​Border​Thickness(for:​ NSRect​Edge)

Indicates the thickness of a given border of the window.

func set​Content​Border​Thickness(CGFloat, for:​ NSRect​Edge)

Specifies the thickness of a given border of the window.

var prevents​Application​Termination​When​Modal:​ Bool

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

Accessing Window Information

class func default​Depth​Limit()

Returns the default depth limit for instances of NSWindow.

var window​Number:​ Int

The window number of the window’s window device.

class func window​Numbers(with​Options:​ NSWindow​Number​List​Options)

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

func g​State()

Returns the window’s graphics state object.

Deprecated
func can​Store​Color()

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

Deprecated
var device​Description:​ [String :​ Any]

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

var can​Become​Visible​Without​Login:​ Bool

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

var sharing​Type:​ NSWindow​Sharing​Type

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

var backing​Type:​ NSBacking​Store​Type

The window’s backing store type.

var backing​Location:​ NSWindow​Backing​Location

The location of the window’s backing store.

var preferred​Backing​Location:​ NSWindow​Backing​Location

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

var is​One​Shot:​ Bool

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

var depth​Limit:​ NSWindow​Depth

The depth limit of the window.

var has​Dynamic​Depth​Limit:​ 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 content​Rect(for​Frame​Rect:​ NSRect, style​Mask:​ NSWindow​Style​Mask)

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

class func frame​Rect(for​Content​Rect:​ NSRect, style​Mask:​ NSWindow​Style​Mask)

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

class func min​Frame​Width(with​Title:​ String, style​Mask:​ NSWindow​Style​Mask)

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

func content​Rect(for​Frame​Rect:​ NSRect)

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

func frame​Rect(for​Content​Rect:​ 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.

Managing Sheets

var attached​Sheet:​ NSWindow?

The sheet attached to the window.

var is​Sheet:​ Bool

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

func begin​Sheet(NSWindow, completion​Handler:​ ((NSModal​Response) -> Void)? = nil)

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

func begin​Critical​Sheet(NSWindow, completion​Handler:​ ((NSModal​Response) -> Void)? = nil)

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

func end​Sheet(NSWindow)

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

func end​Sheet(NSWindow, return​Code:​ NSModal​Response)

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

var sheet​Parent:​ 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 set​Frame​Origin(NSPoint)

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

func set​Frame​Top​Left​Point(NSPoint)

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

func constrain​Frame​Rect(NSRect, to:​ NSScreen?)

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

func cascade​Top​Left(from:​ NSPoint)

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

func set​Frame(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 set​Frame(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 animation​Resize​Time(NSRect)

Specifies the duration of a smooth frame-size change.

var aspect​Ratio:​ 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 min​Size:​ NSSize

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

var max​Size:​ NSSize

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

var is​Zoomed:​ Bool

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

func perform​Zoom(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 resize​Flags:​ Int

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

var shows​Resize​Indicator:​ Bool

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

var resize​Increments:​ NSSize

The window’s resizing increments.

var preserves​Content​During​Live​Resize:​ 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 in​Live​Resize:​ Bool

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

Sizing Content

var content​Aspect​Ratio:​ NSSize

The window’s content aspect ratio.

var content​Min​Size:​ NSSize

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

func set​Content​Size(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 content​Max​Size:​ NSSize

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

var content​Resize​Increments:​ NSSize

The window’s content-view resizing increments.

var content​Layout​Guide:​ Any?

A value used by Auto Layout constraints to automatically bind to the value of content​Layout​Rect.

var content​Layout​Rect:​ NSRect

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

var max​Full​Screen​Content​Size:​ NSSize

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

var min​Full​Screen​Content​Size:​ 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 order​Out(Any?)

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

func order​Back(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 order​Front(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 order​Front​Regardless()

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(NSWindow​Ordering​Mode, relative​To:​ 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 is​Visible:​ Bool

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

Managing Window Frames in User Defaults

class func remove​Frame(using​Name:​ String)

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

func set​Frame​Using​Name(String)

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

func set​Frame​Using​Name(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 save​Frame(using​Name:​ String)

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

var frame​Autosave​Name:​ String

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

var string​With​Saved​Frame:​ String

A string representation of the window’s frame rectangle.

func set​Frame​From(String)

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

Managing Key Status

var is​Key​Window:​ Bool

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

var can​Become​Key:​ Bool

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

func make​Key()

Makes the window the key window.

func make​Key​And​Order​Front(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 become​Key()

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

func resign​Key()

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

Managing Main Status

var is​Main​Window:​ Bool

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

var can​Become​Main:​ Bool

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

func make​Main()

Makes the window the main window.

func become​Main()

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

func resign​Main()

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

Managing Toolbars

var toolbar:​ NSToolbar?

The window’s toolbar.

func toggle​Toolbar​Shown(Any?)

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

func run​Toolbar​Customization​Palette(Any?)

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

Managing Attached Windows

var child​Windows:​ [NSWindow]?

An array of the window’s attached child windows.

func add​Child​Window(NSWindow, ordered:​ NSWindow​Ordering​Mode)

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

func remove​Child​Window(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 is​Flush​Window​Disabled:​ Bool

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

func enable​Flushing()

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

func disable​Flushing()

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 flush​If​Needed()

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 default​Button​Cell:​ NSButton​Cell?

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

func enable​Key​Equivalent​For​Default​Button​Cell()

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

func disable​Key​Equivalent​For​Default​Button​Cell()

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 field​Editor(Bool, for:​ Any?)

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

func end​Editing(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 is​Excluded​From​Windows​Menu:​ Bool

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

Managing Cursor Rectangles

var are​Cursor​Rects​Enabled:​ Bool

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

func enable​Cursor​Rects()

Reenables cursor rectangle management within the window after a disable​Cursor​Rects() message.

func disable​Cursor​Rects()

Disables all cursor rectangle management within the window.

func discard​Cursor​Rects()

Invalidates all cursor rectangles in the window.

func invalidate​Cursor​Rects(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 reset​Cursor​Rects()

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

Managing Title Bars

class func standard​Window​Button(NSWindow​Button, for:​ NSWindow​Style​Mask)

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

func standard​Window​Button(NSWindow​Button)

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

var shows​Toolbar​Button:​ Bool

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

var titlebar​Appears​Transparent:​ Bool

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

Managing the Toolbar-Title Bar Area

func add​Titlebar​Accessory​View​Controller(NSTitlebar​Accessory​View​Controller)

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

func insert​Titlebar​Accessory​View​Controller(NSTitlebar​Accessory​View​Controller, at:​ Int)

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

func perform​Drag(with:​ NSEvent)

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

func remove​Titlebar​Accessory​View​Controller(at:​ Int)

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

var titlebar​Accessory​View​Controllers:​ [NSTitlebar​Accessory​View​Controller]

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

Managing Tooltips

var allows​Tool​Tips​When​Application​Is​Inactive:​ Bool

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

Handling Events

class func menu​Changed(NSMenu)

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

Deprecated
var current​Event:​ NSEvent?

The event currently being processed by the application.

func next​Event(matching:​ NSEvent​Mask)

Returns the next event matching a given mask.

func discard​Events(matching:​ NSEvent​Mask, before:​ NSEvent?)

Forwards the message to the NSApplication object, NSApp.

func post​Event(NSEvent, at​Start:​ Bool)

Forwards the message to the global NSApplication object, NSApp.

func send​Event(NSEvent)

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

func `try`(to​Perform:​ Selector, with:​ Any?)

Dispatches action messages with a given argument.

Managing Responders

var initial​First​Responder:​ NSView?

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

var first​Responder:​ NSResponder

The window’s first responder.

func make​First​Responder(NSResponder?)

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

Managing the Key View Loop

func select​Key​View(preceding:​ NSView)

Makes key the view that precedes the given view.

func select​Key​View(following:​ NSView)

Makes key the view that follows the given view.

func select​Previous​Key​View(Any?)

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

func select​Next​Key​View(Any?)

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

var key​View​Selection​Direction:​ NSSelection​Direction

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

var autorecalculates​Key​View​Loop:​ Bool

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

func recalculate​Key​View​Loop()

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

Handling Keyboard Events

func key​Down(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 accepts​Mouse​Moved​Events:​ Bool

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

var ignores​Mouse​Events:​ Bool

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

var mouse​Location​Outside​Of​Event​Stream:​ 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 window​Number(at:​ NSPoint, below​Window​With​Window​Number:​ Int)

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

func track​Events(matching:​ NSEvent​Mask, timeout:​ Time​Interval, mode:​ Run​Loop​Mode, handler:​ (NSEvent, Unsafe​Mutable​Pointer<Obj​CBool>) -> Void)

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

Handling Window Restoration

var is​Restorable:​ Bool

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

var restoration​Class:​ NSWindow​Restoration.Type?

The restoration class associated with the window.

func disable​Snapshot​Restoration()

Disable snapshot restoration.

func enable​Snapshot​Restoration()

Enable snapshot restoration.

Bracketing Drawing Operations

func cache​Image(in:​ NSRect)

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

func restore​Cached​Image()

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 cache​Image(in:​).

func discard​Cached​Image()

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 display​If​Needed()

Passes a display​If​Needed 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 views​Need​Display:​ Bool

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

var is​Autodisplay:​ Bool

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

func use​Optimized​Drawing(Bool)

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

Deprecated
var graphics​Context:​ NSGraphics​Context?

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

var allows​Concurrent​View​Drawing:​ Bool

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

Window Animation

var animation​Behavior:​ NSWindow​Animation​Behavior

The window’s automatic animation behavior.

Updating Windows

func disable​Screen​Updates​Until​Flush()

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

func update()

Updates the window.

Dragging Items

func register​For​Dragged​Types([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 unregister​Dragged​Types()

Unregisters the window as a possible destination for dragging operations.

Accessing Edited Status

var is​Document​Edited:​ Bool

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

Converting Coordinates

func backing​Aligned​Rect(NSRect, options:​ Alignment​Options = [])

Returns a backing store pixel aligned rectangle in window coordinates.

func convert​From​Backing(NSRect)

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

func convert​To​Backing(NSRect)

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

func convert​To​Screen(NSRect)

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

func convert​From​Screen(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 title​Visibility:​ NSWindow​Title​Visibility

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

func set​Title​With​Represented​Filename(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 represented​Filename.

var represented​Filename:​ String

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

var represented​URL:​ URL?

The URL of the file the window represents.

Accessing Screen Information

var screen:​ NSScreen?

The screen the window is on.

var deepest​Screen:​ NSScreen?

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

var displays​When​Screen​Profile​Changes:​ 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 is​Movable​By​Window​Background:​ Bool

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

var is​Movable:​ 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 perform​Close(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 is​Released​When​Closed:​ Bool

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

Minimizing Windows

var is​Miniaturized:​ Bool

A Boolean value that indicates whether the window is minimized.

func perform​Miniaturize(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 miniwindow​Image:​ NSImage?

The custom miniaturized window image of the window.

var miniwindow​Title:​ String!

The title displayed in the window’s minimized window.

Getting the Dock Tile

var dock​Tile:​ NSDock​Tile

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 data​With​EPS(inside:​ NSRect)

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

func data​With​PDF(inside:​ NSRect)

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

Providing Services

func valid​Requestor(for​Send​Type:​ String, return​Type:​ String)

Searches for an object that responds to a Services request.

Triggering Constraint-Based Layout

func update​Constraints​If​Needed()

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

func layout​If​Needed()

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 visualize​Constraints([NSLayout​Constraint])

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

Constraint-Based Layouts

func anchor​Attribute(for:​ NSLayout​Constraint​Orientation)

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

func set​Anchor​Attribute(NSLayout​Attribute, for:​ NSLayout​Constraint​Orientation)

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

Working with Carbon

init?(window​Ref:​ Unsafe​Mutable​Raw​Pointer)

Returns a Cocoa window created from a Carbon window.

var window​Ref:​ Unsafe​Mutable​Raw​Pointer

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

Constants

NSWindow​Style​Mask

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 device​Description.

Managing Scaling Factors

Manages scaling factors.

NSSelection​Direction

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

NSWindow​Button

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

NSWindow​Depth

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 depth​Limit.

NSBacking​Store​Type

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

NSWindow​Ordering​Mode

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

NSWindow​Sharing​Type

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

NSWindow​Backing​Location

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

NSWindow​Animation​Behavior

These constants control the automatic window animation behavior used when the order​Front(_:​) or order​Out(_:​) methods are called.

NSWindow​Collection​Behavior

Window collection behaviors related to Exposé and Spaces.

NSWindow​Occlusion​State

Specifies whether the window is occluded.

NSWindow​Title​Visibility

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

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 NSWindow​Did​Become​Key:​ NSNotification.Name

Posted whenever an NSWindow object becomes the key window.

static let NSWindow​Did​Become​Main:​ NSNotification.Name

Posted whenever an NSWindow object becomes the main window.

static let NSWindow​Did​Change​Screen:​ NSNotification.Name

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

static let NSWindow​Did​Change​Screen​Profile:​ NSNotification.Name

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

static let NSWindow​Did​Deminiaturize:​ NSNotification.Name

Posted whenever an NSWindow object is deminimized.

static let NSWindow​Did​End​Sheet:​ NSNotification.Name

Posted whenever an NSWindow object closes an attached sheet.

static let NSWindow​Did​Expose:​ 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 NSWindow​Did​Miniaturize:​ NSNotification.Name

Posted whenever an NSWindow object is minimized.

static let NSWindow​Did​Move:​ NSNotification.Name

Posted whenever an NSWindow object is moved.

static let NSWindow​Did​Resign​Key:​ NSNotification.Name

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

static let NSWindow​Did​Resign​Main:​ NSNotification.Name

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

static let NSWindow​Did​Resize:​ NSNotification.Name

Posted whenever an NSWindow object’s size changes.

static let NSWindow​Did​Update:​ NSNotification.Name

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

static let NSWindow​Will​Begin​Sheet:​ NSNotification.Name

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

static let NSWindow​Will​Close:​ NSNotification.Name

Posted whenever an NSWindow object is about to close.

static let NSWindow​Will​Miniaturize:​ NSNotification.Name

Posted whenever an NSWindow object is about to be minimized.

static let NSWindow​Will​Move:​ NSNotification.Name

Posted whenever an NSWindow object is about to move.

static let NSWindow​Will​Enter​Full​Screen:​ NSNotification.Name

Posted when the window will enter full screen mode.

static let NSWindow​Will​Exit​Full​Screen:​ NSNotification.Name

Posted when the window will exit full screen mode.

static let NSWindow​Did​Exit​Full​Screen:​ NSNotification.Name

Posted when the window did exit full screen mode.

static let NSWindow​Will​Enter​Version​Browser:​ NSNotification.Name

Posted when the window will enter version browser mode.

static let NSWindow​Did​Enter​Version​Browser:​ NSNotification.Name

Posted when the window will enter version browser mode.

static let NSWindow​Will​Exit​Version​Browser:​ NSNotification.Name

Posted when the window will exit version browser mode.

static let NSWindow​Did​Exit​Version​Browser:​ NSNotification.Name

Posted when the window did exit version browser mode.

Instance Properties

Instance Methods

func add​Tabbed​Window(NSWindow, ordered:​ NSWindow​Ordering​Mode)func can​Represent(NSDisplay​Gamut)
func handle​Close(NSClose​Command)

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

func handle​Print(NSScript​Command)

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

func handle​Save(NSScript​Command)

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

func merge​All​Windows(Any?)func move​Tab​To​New​Window(Any?)func select​Next​Tab(Any?)func select​Previous​Tab(Any?)func set​Dynamic​Depth​Limit(Bool)func set​Frame​Autosave​Name(String)
func set​Is​Miniaturized(Bool)

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

func set​Is​Visible(Bool)

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

func set​Is​Zoomed(Bool)

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

func toggle​Tab​Bar(Any?)