O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

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

For the More Curious: Key Paths

Objects are often arranged in a network. For example, a person might have a spouse who has a scooter that has a model name (Figure 8.14).

Figure 8.14  Directed graph of objects

Directed graph of objects

To get the selected person’s spouse’s scooter’s model name, you can use a key path:

l​e​t​ ​m​o​d​e​l​N​a​m​e​ ​=​ ​s​e​l​e​c​t​e​d​P​e​r​s​o​n​.​v​a​l​u​e​F​o​r​K​e​y​P​a​t​h​(​"​s​p​o​u​s​e​.​s​c​o​o​t​e​r​.​m​o​d​e​l​N​a​m​e​"​)​ ​a​s​ ​S​t​r​i​n​g​

We would say that spouse and scooter are relationships of the Person class and that modelName is an attribute of the Scooter class.

There are also operators that you ...

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