Provides a mechanism for registering handler routines for specific types of Apple events and dispatching events to those handlers.
- macOS 10.0+
Cocoa provides built-in scriptability support that uses scriptability information supplied by an application to automatically convert Apple events into script command objects that perform the desired operation. However, some applications may want to perform more basic Apple event handling, in which an application registers handlers for the Apple events it can process, then calls on the Apple Event Manager to dispatch received Apple events to the appropriate handler.
NSApple supports these mechanisms by providing methods to register and remove handlers and to dispatch Apple events to the appropriate handler, if one exists. For related information, see How Cocoa Applications Handle Apple Events
Each application has at most one instance of
NSApple. To obtain a reference to it, you call the class method
shared(), which creates the instance if it doesn’t already exist.
For information about the Apple Event Manager, see Apple Event Manager and Apple Events Programming Guide.