---
title: keyWindow
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsapplication/keywindow
---

# keyWindow

The window that currently receives keyboard events.

## Declaration

```swift
weak var keyWindow: NSWindow? { get }
```

## Discussion

Discussion The value of this property is nil when there is no window receiving keyboard events. The property might be nil because the app’s storyboard file has not yet finished loading or when the receiver is not active.

## See Also

### Related Documentation

- [isKeyWindow](appkit/nswindow/iskeywindow.md)

### Managing App Windows

- [mainWindow](appkit/nsapplication/mainwindow.md)
- [window(withWindowNumber:)](appkit/nsapplication/window(withwindownumber:).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)
