I'm working on a project where I'm downloading a whole mess of JSON and then making a pretty UITableView out of it.
I've got the JSON parsed out into a nice NSMutableArray which I then feed into the UITableView. Everything works and looks pretty.
The problem that I'm having is that my NSMutableArray has a dictionary object in it that I'm wanting to use to perform filtering of the tableview on.
This is a NSLog of an object in the NSMutableArray that I'm looking at:
{
id = 123456;
issues = (
{
id = 4;
name = "Ape";
},
{
id = 25;
name = "Chimp";
},
{
id = 28;
name = "Human";
}
);
status = open;
}
What I want to write is a predicate filter on any of the name column in the issues dictionary in the NSMutableArray.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K == %@", @"name", @"Human"];
NSArray *predicateFilteredArray = [tableViewArray filteredArrayUsingPredicate:predicate];
However I can't figure out the right format for the predicate variable that will match names in issues. I've read and reread the Predicate Programming guide and about half of the stack overflow items flagged NSPredicate and I can't figure out the syntax. I've tried lots of variations of SELF and am just plain old stuck.