Filter NSArray based on another array using predicate
Consider the arrays below. The arrays contain objects of type 'Alpha'. We only care about the property username which is of type NSString . NSArray *some_usernames = @[ <multiple values of type Alpha> ] NSArray *all_usernames = @[ <multiple values of type Alpha> ] I basically want a list of all the usernames that are not in the array some_usernames , i.e. NSArray *remaining_usernames = @[ <all_usernames but not in some_usernames> ]; The way I would intend to do is: NSPredicates *predicates; for (Alpha *alpha in some_usernames) { predicate = [predicate with @"username != %@", alpha.username];