Returns a predicate that matches objects based on the provided metadata key, value, and operator.
- iOS 8.0+
- Mac Catalyst 13.0+
- watchOS 2.0+
The metadata key for the value to be matched. For a list of preset keys, see Metadata Keys. You may also search using custom keys.
Defines the relationship used to match the metadata’s value with the provided value.
A predicate that matches objects based on the specified metadata key, operator, and value.
Use this convenience method to create a predicate that matches objects based on their metadata, an operator, and a target value. When this predicate is evaluated, it gets the metadata’s value for the provided key. Then the predicate compares that value with the target value using the provided operator.
The following sample uses both the convenience method and a predicate format string to create equivalent predicates.