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

# windowNumber

The window number of the window’s window device.

```
var windowNumber: Int { get }
```

## Discussion

Each window device in an application is given a unique window number—note that this isn’t the same as the global window number assigned by the window server. This number can be used to identify the window device with the [`order(_:relativeTo:)`](/documentation/AppKit/NSWindow/order(_:relativeTo:)) method and in the AppKit function [`NSWindowList`](/documentation/AppKit/NSWindowList).

If the window doesn’t have a window device, the value of this property is equal to or less than `0`.

## See Also

[`oneShot`](/documentation/AppKit/NSWindow/isOneShot)

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

[`-  initWithContentRect:styleMask:backing:defer:`](/documentation/AppKit/NSWindow/init(contentRect:styleMask:backing:defer:))

Initializes the window with the specified values.



---

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)