Protocol

NSApplication​Delegate

The NSApplication​Delegate protocol defines the methods that may be implemented by delegates of NSApplication objects.

Symbols

Launching Applications

func application​Will​Finish​Launching(Notification)

Sent by the default notification center immediately before the application object is initialized.

func application​Did​Finish​Launching(Notification)

Sent by the default notification center after the application has been launched and initialized but before it has received its first event.

Terminating Applications

func application​Should​Terminate(NSApplication)

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

func application​Should​Terminate​After​Last​Window​Closed(NSApplication)

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

func application​Will​Terminate(Notification)

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

Managing Active Status

func application​Will​Become​Active(Notification)

Sent by the default notification center immediately before the application becomes active.

func application​Did​Become​Active(Notification)

Sent by the default notification center immediately after the application becomes active.

func application​Will​Resign​Active(Notification)

Sent by the default notification center immediately before the application is deactivated.

func application​Did​Resign​Active(Notification)

Sent by the default notification center immediately after the application is deactivated.

Hiding Applications

func application​Will​Hide(Notification)

Sent by the default notification center immediately before the application is hidden.

func application​Did​Hide(Notification)

Sent by the default notification center immediately after the application is hidden.

func application​Will​Unhide(Notification)

Sent by the default notification center immediately after the application is unhidden.

func application​Did​Unhide(Notification)

Sent by the default notification center immediately after the application is made visible.

Managing Windows

func application​Will​Update(Notification)

Sent by the default notification center immediately before the application object updates its windows.

func application​Did​Update(Notification)

Sent by the default notification center immediately after the application object updates its windows.

func application​Should​Handle​Reopen(NSApplication, has​Visible​Windows:​ Bool)

Sent by the application to the delegate prior to default behavior to reopen (rapp) AppleEvents.

Managing the Dock Menu

func application​Dock​Menu(NSApplication)

Allows the delegate to supply a dock menu for the application dynamically.

Displaying Errors

func application(NSApplication, will​Present​Error:​ Error)

Sent to the delegate before the specified application presents an error message to the user.

Managing the Screen

func application​Did​Change​Screen​Parameters(Notification)

Sent by the default notification center when the configuration of the displays attached to the computer is changed (either programmatically or when the user changes settings in the Displays control panel).

Opening Files

func application(NSApplication, open​File:​ String)

Tells the delegate to open a single file.

func application(Any, open​File​Without​UI:​ String)

Tells the delegate to open a file programmatically.

func application(NSApplication, open​Temp​File:​ String)

Tells the delegate to open a temporary file.

func application(NSApplication, open​Files:​ [String])

Tells the delegate to open multiple files.

func application​Open​Untitled​File(NSApplication)

Tells the delegate to open an untitled file.

func application​Should​Open​Untitled​File(NSApplication)

Invoked immediately before opening an untitled file.

Handling Push Notifications

func application(NSApplication, did​Register​For​Remote​Notifications​With​Device​Token:​ Data)

Sent to the delegate when Apple Push Services successfully completes the registration process.

func application(NSApplication, did​Fail​To​Register​For​Remote​Notifications​With​Error:​ Error)

Sent to the delegate when Apple Push Service cannot successfully complete the registration process.

func application(NSApplication, did​Receive​Remote​Notification:​ [String :​ Any])

Sent to the delegate when a running application receives a remote notification.

Application Restorable State

func application(NSApplication, did​Decode​Restorable​State:​ NSCoder)

Tells the delegate the application has extracted its restorable state from a given archiver.

func application(NSApplication, will​Encode​Restorable​State:​ NSCoder)

Tells the delegate the application will encode any application state that was preserved between application launches.

Continuing User Activities

func application(NSApplication, will​Continue​User​Activity​With​Type:​ String)

Tells the delegate the user wants to continue an activity in your app.

func application(NSApplication, continue:​ NSUser​Activity, restoration​Handler:​ ([Any]) -> Void)

Tells the delegate that the data for continuing an activity is available.

func application(NSApplication, did​Update:​ NSUser​Activity)

Tells the delegate that the user activity object has been updated.

Occlusion State

func application​Did​Change​Occlusion​State(Notification)

Tells the delegate the application’s occlusion state changed.

Relationships

Inherits From