Contents

predicate

A predicate that specifies which properties to select results by and that also specifies any constraints on selection.

Declaration

var predicate: NSPredicate? { get set }

Discussion

Construct a predicate with the properties of the class of objects that you want to fetch, listed in the PHFetchOptions table. For example, the following code uses a predicate to fetch assets matching a specific set of mediaSubtypes values.

Photos does not support predicates created with the NSPredicate method init or the predicateWithBlock method.

See Also

Sorting and Filtering Fetch Results