Objective-C Language Filtering Array content with Predicate


Example

Using filterUsingPredicate: This Evaluates a given predicate against the arrays content and return objects that match.

Example:

      NSMutableArray *array = [NSMutableArray array];
      [array setArray:@[@"iOS",@"macOS",@"tvOS"]];
      NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] 'i'"];
      NSArray *resultArray = [array filteredArrayUsingPredicate:predicate];
      NSLog(@"%@",resultArray);