An abstract class that forms the basis of event and command processing in AppKit.
SDK
- macOS 10.0+
Framework
- App
Kit
Declaration
class NSResponder : NSObject
Overview
The core classes—NSApplication
, NSWindow
, and NSView
—inherit from NSResponder
, as must any class that handles events. The responder model is built around three components: event messages, action messages, and the responder chain.
NSResponder
also plays an important role in the presentation of error information. The default implementations of the present
and present
methods send will
to self
, thereby giving subclasses the opportunity to customize the localized information presented in error alerts. NSResponder
then forwards the message to the next responder, passing it the customized NSError
object. The exact path up the modified responder chain depends on the type of application window:
Window owned by document: view > superviews > window > window controller > document object > document controller > the application object
Window with window controller but no documents: view > superviews > window > window controller > the application object
Window with no window controllers: view > superviews > window > the application object
NSApplication
displays a document-modal error alert and, if the error object has a recovery attempter, gives it a chance to recover from the error. (A recovery attempter is an object that conforms to the NSErrorRecoveryAttempting informal protocol.)