Reputation: 9040
This is my array,
NSArray *peopleArray = @[
@{@"name":@"Albert",@"age":@"23"},
@{@"name":@"Bruce",@"age":@"25"},
@{@"name":@"Christopher",@"age":@"56"},
@{@"name":@"Hardy",@"age":@"38"},
@{@"name":@"Marlon",@"age":@"20"},
];
I want to get all the names in the above array, using NSPredicates.
NSArray *names = ;//
//Albert,Bruce,Christopher,Hardy,Marlon
Upvotes: 3
Views: 644
Reputation: 119031
Don't use a predicate to extract all of the names, use KVC instead:
NSArray *names = [peopleArray valueForKey:@"name"];
Now that you have the array of names you can use a predicate to filter it if required.
Upvotes: 8