predicateForObjects(withMetadataKey:allowedValues:)
Returns a predicate that matches objects based on the provided metadata key and an array of target values.
Declaration
class func predicateForObjects(withMetadataKey key: String, allowedValues: [Any]) -> NSPredicateParameters
Return Value
A predicate that matches objects based on the provided metadata key and an array of target values..
Discussion
Use this convenience method to create a predicate that matches objects based on their metadata. When this predicate is evaluated, it gets the metadata’s value for the provided key. Then the predicate checks that value against the allowedValues array. If the array contains a matching value, the predicate returns true; otherwise, it returns false.
The following sample uses both the convenience method and a predicate format string to create equivalent predicates.
See Also
Related Documentation
Creating object predicates
predicateForObject(with:)predicateForObjects(with:)predicateForObjects(from:)predicateForObjects(from:)predicateForObjects(from:)predicateForObjects(withDeviceProperty:allowedValues:)predicateForObjects(from:)predicateForObjects(withMetadataKey:)predicateForObjects(withMetadataKey:operatorType:value:)predicateForObjectsWithNoCorrelation()