In this chapter there are 2 sub topics — Sorting array and filtering Mutablearray
and I suppose key value coding is used in both of these sub topics
Ok lets start with the first sub topic- Sorting array
NSSortDescriptor *voa = [NSSortDescriptor sortDescriptorWithKey:@"valueOfAssets"
NSSortDescriptor *eid = [NSSortDescriptor sortDescriptorWithKey:@"employeeID"
The code above shows the method
sortDescriptorWithKey being used and key value coding is applied here, the argument of the method is key value coding @“valueOfAssets”
Now lets fast forward to the 2nd sub topics filtering NSMutablrArray
we see here NSPredicate is used for filtering purposes
here’s the code
NSPredicate *predicate = [NSPredicate predicateWithFormat:
@"holder.valueOfAssets > 70"];
predicateWithFormat method is used here with key value coding holder.valueOfAssets > 70
Ok now lets compare the 1st key value coding used to the 2nd one.
In the first key value coding, the “holder” is not used as compared to the 2nd key value coding where “holder” is used.
So which one is correct, or which one should i use?