Instance Method

filteredArrayUsingPredicate:

Evaluates a given predicate against each object in the receiving array and returns a new array containing the objects for which the predicate returns true.

Declaration

- (NSArray<ObjectType> *)filteredArrayUsingPredicate:(NSPredicate *)predicate;

Parameters

predicate

The predicate against which to evaluate the receiving array’s elements.

Return Value

A new array containing the objects in the receiving array for which predicate returns YES.

Objects in the resulting array appear in the same order as they do in the receiver.

Discussion

For more details, see Predicate Programming Guide.

See Also

Deriving New Arrays

- arrayByAddingObject:

Returns a new array that is a copy of the receiving array with a given object added to the end.

- arrayByAddingObjectsFromArray:

Returns a new array that is a copy of the receiving array with the objects contained in another array added to the end.

- subarrayWithRange:

Returns a new array containing the receiving array’s elements that fall within the limits specified by a given range.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software