Key paths
Most applications end up with a relatively complex object graph. For example, you might have a BNRDepartment object that has a manager property that is a pointer to an BNREmployee object which has an emergencyContact property which is a pointer to a BNRPerson object which has a phoneNumber property.
Figure 35.1 Complex object graph
Imagine that you are asked, “What is the phone number of the emergency contact for the manager of the sales department?” You could use key-value coding to traverse these relationships one at a time:
BNRDepartment *sales = …; BNREmployee *sickEmployee ...
Get Objective-C Programming: The Big Nerd Ranch Guide 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.