priore

Filter an NSArray of NSDictionary with NSPredicate

Jan 23rd, 2014
521
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NSPredicate *filter = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
  2.         return [[evaluatedObject valueForKeyPath:@"activity.object.type"]
  3.                 isEqualToString:@"FILTER-TEXT-VALUE"];
  4. }];
  5. NSArray *new_array = [you-array filteredArrayUsingPredicate:filter];
RAW Paste Data