NSResponder is an abstract class that forms the basis of event and command processing in AppKit. The core classes—
NSResponder, as must any class that handles events. The responder model is built around three components: event messages, action messages, and the responder chain.
- macOS 10.10+
NSResponder plays an important role in the presentation of error information. The default implementations of the
presentError(_:modalFor:delegate:didPresent:contextInfo:) methods send
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.)