Is there any of way (other than looping) of extracting a particular property of all objects in an array. So say there in an array of people. I want to extract all their first names into an array.
2 Answers
Key Value coding will help you with that:
NSArray *result = [people valueForKey:@"firstname"];
2 Comments
nonolays
Big +1 to JustSid. Works great. Note:
people must be an NSArray to be true. If people is a NSSet the result will be a NSSetAfsal Meerankutty
How to achieve the same in swift ?