15. Delegates
A delegate is an object that’s given an opportunity to react to changes in another object or influence the behavior of another object. The basic idea is that two objects coordinate to solve a problem. One object is very general and intended for reuse in a wide variety of situations. It stores a reference to another object, its delegate, and sends messages to the delegate at critical times. The messages may just inform the delegate that something has happened, giving the delegate an opportunity to do extra processing, or the messages may ask the delegate for critical information that will control what happens. The delegate is typically a unique custom object within the Controller subsystem of your application.
Delegates are one ...
Get Cocoa Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.