Creating an array from properties of objects in another array
This will return an array containing the value of licensePlate
from each item in the myCars
array:
NSArray *licensePlates = [myCars valueForKeyPath:@"licensePlate"]
If you want only unique items (for example), you can do something like this:
NSArray *licensePlates = [myCars valueForKeyPath:@"@distinctUnionOfObjects.licensePlate"];
For more possibilities, see the Collection Operators documentation in the Key-Value Coding Programming Guide.