---
title: "window(withWindowNumber:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsapplication/window(withwindownumber:)"
---

# window(withWindowNumber:)

Returns the window corresponding to the specified window number.

## Declaration

```swift
func window(withWindowNumber windowNum: Int) -> NSWindow?
```

## Parameters

- `windowNum`: The unique window number associated with the desired doc://com.apple.appkit/documentation/AppKit/NSWindow object.

## Return Value

Return Value The desired window object or nil if the window could not be found.

## Discussion

Discussion window(withWindowNumber:) may return nil for window numbers found using windowNumbers(options:) if there is no corresponding window object owned by your app—for example, the menu bar.

## See Also

### Managing App Windows

- [keyWindow](appkit/nsapplication/keywindow.md)
- [mainWindow](appkit/nsapplication/mainwindow.md)
- [windows](appkit/nsapplication/windows.md)
- [makeWindowsPerform(_:inOrder:)](appkit/nsapplication/makewindowsperform(_:inorder:).md)
- [enumerateWindows(options:using:)](appkit/nsapplication/enumeratewindows(options:using:).md)
- [NSApplication.WindowListOptions](appkit/nsapplication/windowlistoptions.md)
