Chapter 5. Notifications and implementing the observer pattern

 

This chapter covers
  • Notifying multiple objects
  • Posting and queuing notifications
  • Observing notifications
  • Building an iTunes-notification observer

 

In chapter 4, you learned a core fundamental of Cocoa development: delegation. But sometimes creating your own delegates won’t work. This is where notifications come in. Delegates are important and are used throughout Cocoa, but delegates assign one object as the delegate object—this single object is responsible for responding to an event. What if you need multiple objects to respond to the same event? That’s when you want to use notifications.

By the end of this chapter, you’ll be a notification ninja. We’ll explore what makes ...

Get MacRuby in Action 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.