O'Reilly logo

Objective-C Quick Syntax Reference by Matthew Campbell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 22

image

Key-Value Observation

Key-Value Observation Defined

One of the applications of key-value coding is implementing the observer pattern. The observer pattern is used when you want an object to get a notification when the state of another object changes. This pattern is implemented with key-value observation in Objective-C.

To see a clear example of key-value observation, you need at least two objects. One object will be observed while the other object will be observing. For this example, let’s assume that you have two types of objects: a Project object and a Task object. Project objects maintain a list of Task objects. The project object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required