---
title: "windowWillClose(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nswindowdelegate/windowwillclose(_:)"
---

# windowWillClose(_:)

Tells the delegate that the window is about to close.

## Declaration

```swift
@MainActor optional func windowWillClose(_ notification: Notification)
```

## Parameters

- `notification`: A notification named doc://com.apple.appkit/documentation/AppKit/NSWindow/willCloseNotification.

## Discussion

Discussion You can retrieve the NSWindow object in question by sending object to notification.

## See Also

### Closing Windows

- [windowShouldClose(_:)](appkit/nswindowdelegate/windowshouldclose(_:).md)
