14. Notifications

The Notification pattern enables communication between objects without tight coupling. An object is able to broadcast information to any number of other objects without any specific information about the other objects. An instance of Cocoa’s NSNotification class encapsulates the information to be broadcast. Objects that are interested in receiving the information register themselves with an instance of Cocoa’s NSNotificationCenter class. Registered objects are called observers, and the Notification pattern is sometimes called the “Observer” pattern in other frameworks. Registered observers specify the types of communication desired.

When a notification is sent to a notification center, the notification center distributes the ...

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.