O'Reilly logo

Objective-C Fundamentals by Collin Ruffenach, Johannes Fahrenkrug, Christopher K. Fairbairn

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 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 ...

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