Evaluates a given predicate against the array’s content and leaves only objects that match.
SDKs
- iOS 3.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
func filter(using predicate: NSPredicate)
Parameters
predicate
The predicate to evaluate against the array’s elements.