---
title: mainWindow
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsapplication/mainwindow
---

# mainWindow

The app’s main window.

## Declaration

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

## Discussion

Discussion The value in this property is nil when the app’s storyboard or nib file has not yet finished loading. It might also be nil when the app is inactive or hidden.

## See Also

### Related Documentation

- [isMainWindow](appkit/nswindow/ismainwindow.md)

### Managing App Windows

- [keyWindow](appkit/nsapplication/keywindow.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)
