I have used NSPredicate before but for different purpose. But I am stuck in following scenario for query.
I have array Persons which contains Person Objects i.e Persons is array of objects. I need to collect all names_ from all person objects from persons array. I know we can do it through for loop but can we do it through NSpredicate or more optimize way?
NSMutableArray *names;
for (int i=0; i<[persons count]; i++)
{
[names addObject:[[persons objectAtIndex:i] names_]];
}
This one line would do,