Instance Method


Sent by the default notification center immediately before the application terminates.


optional func applicationWillTerminate(_ notification: Notification)



A notification named willTerminateNotification. Calling the object method of this notification returns the NSApplication object itself.


Your delegate can use this method to perform any final cleanup before the application terminates.

See Also

Terminating Applications

func applicationShouldTerminate(NSApplication) -> NSApplication.TerminateReply

Sent to notify the delegate that the application is about to terminate.

func applicationShouldTerminateAfterLastWindowClosed(NSApplication) -> Bool

Invoked when the user closes the last window the application has open.

enum NSApplication.TerminateReply

Constants used by the delegate method applicationShouldTerminate(_:) to determine whether an app should terminate.