filter(using:)
Evaluates a given predicate against the set’s content and removes from the set those objects for which the predicate returns false.
Declaration
func filter(using predicate: NSPredicate)Parameters
- predicate:
A predicate.
Discussion
The following example illustrates the use of this method.
NSMutableSet *mutableSet =
[NSMutableSet setWithObjects:@"One", @"Two", @"Three", @"Four", nil];
NSPredicate *predicate =
[NSPredicate predicateWithFormat:@"SELF beginswith 'T'"];
[mutableSet filterUsingPredicate:predicate];
// mutableSet contains (Two, Three)