Chapter 11. Key-Value Coding and NSPredicate


This chapter covers
  • Key-Value Coding (KVC)
  • Handling nil values in KVC
  • Filtering a collection with predicates
  • Using key paths in predicate expressions


KVC is a feature of the Foundation framework that allows you to access the properties of an object using strings. To obtain the current value of an object’s property, you usually send the object an explicit getter message, as demonstrated here:

CTRentalProperty *house = ...;
NSString *addressOfProperty = [house address];

Given an instance of the CTRentalProperty class developed in chapter 5, this would return the current value of the house’s address property. In Objective C 2.0 you could also use the following alternative property accessor ...

Get Objective-C Fundamentals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.