NSApplicationDelegate
NSApplicationDelegate is a protocol in the AppKit framework that defines the delegate interface for NSApplication objects. An object that conforms to the protocol can receive messages about the application's lifecycle and other high-level events, enabling centralized control of app behavior without subclassing NSApplication. The NSApplicationDelegate protocol is part of the Cocoa application architecture; its methods are optional, so a delegate implements only the events it needs.
Common methods include applicationDidFinishLaunching, invoked when the app has completed its launch; applicationWillTerminate, called just before
In practice, the delegate is typically implemented by an AppDelegate class that conforms to NSApplicationDelegate and
The concept complements the NSApplication and the broader AppKit lifecycle, and is a common component in macOS