A predicate (NSPredicate) is a logical selection condition of OC for a data set, similar to a filter

Person * p1 = [Person personWithName:@"alex" Age:20]; . Person * p5 = [Person personWithName:@"alex4" Age:80]; NSArray * persons = @[p1, p2, p3, p4, p5]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"age < 30"]; / / use the predicate filter element in the array, returns after filtering the results of the query NSArray * array = [persons filteredArrayUsingPredicate: predicate];Copy the code

www.jianshu.com/p/0e787ab6e…