<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindowController/window",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWindowController(py)window"
  },
  "title" : "window"
}
-->

# window

The window owned by the receiver.

```
var window: NSWindow? { get set }
```

## Discussion

Accessing this property loads the nib file if there is one and it has not yet been loaded. If the window was loaded, the following methods are called in order: [`windowWillLoad()`](/documentation/AppKit/NSWindowController/windowWillLoad()), [`loadWindow()`](/documentation/AppKit/NSWindowController/loadWindow()), and [`windowDidLoad()`](/documentation/AppKit/NSWindowController/windowDidLoad()). If the window controller has a document, the document’s corresponding methods [`windowControllerWillLoadNib(_:)`](/documentation/AppKit/NSDocument/windowControllerWillLoadNib(_:)) and [`windowControllerDidLoadNib(_:)`](/documentation/AppKit/NSDocument/windowControllerDidLoadNib(_:)) are also called (if implemented). To affect nib loading or do something before or after it happens, you should always override these methods.

Setting this property releases the window controller’s old window along with any associated top-level objects in its nib file, and establishes ownership of the specified new window. Typically, you should not use this property to set the window. Instead, create a new window controller for the new window and then release the old window controller.

## See Also

[`-  windowControllerWillLoadNib:`](/documentation/AppKit/NSDocument/windowControllerWillLoadNib(_:))

Called before one of the document’s window controllers loads its nib file.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)