Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Cocoa’s Responder Chain is a central and essential element of every graphical Cocoa application. It routes user events to the correct objects and simplifies the implementation of context-sensitive application features. The Responder Chain is also known as the Chain of Responsibility pattern.
This chapter describes the behavioral and logic problems that the Responder Chain solves. Application features as diverse as user input, automated menu item validation, undo and redo, copy and paste, font selection, error presentation, and all forms of context-sensitive input are simplified by the Responder Chain. It is closely related to the Hierarchies pattern explained in Chapter 16, “Hierarchies.” Hierarchies are primarily structural in nature; the Responder Chain leverages that structure to implement context-dependent behaviors.