Type Method

predicateWithBlock:

Initializes a predicate that evaluates using a specified block object and bindings dictionary.

Declaration

+ (NSPredicate *)predicateWithBlock:(BOOL (^)(id evaluatedObject, NSDictionary<NSString *,id> *bindings))block;

Parameters

block

The block is applied to the object to be evaluated.

The block takes two arguments:

evaluatedObject

The object to be evaluated.

bindings

The substitution variables dictionary. The dictionary must contain key-value pairs for all variables in the receiver.

The block returns YES if the evaluatedObject evaluates to true, otherwise NO.

Return Value

A new predicate by that evaluates objects using block.

Discussion

In macOS 10.6 and later, Core Data supports block-based predicates in the in-memory and atomic stores, but not in the SQLite-based store.

See Also

Creating a Predicate

+ predicateWithFormat:

Creates and returns a new predicate formed by creating a new string with a given format and parsing the result.

+ predicateWithFormat:argumentArray:

Initializes a predicate by substituting the values in a given array into a format string and parsing the result.

+ predicateWithFormat:arguments:

Initializes a predicate by substituting the values in an argument list into a format string and parsing the result.

- predicateWithSubstitutionVariables:

Returns a copy of the predicate with the predicate's variables substituted by values specified in a given substitution variables dictionary.

+ predicateWithValue:

Creates and returns a predicate that always evaluates to a given Boolean value.

+ predicateFromMetadataQueryString:

Initializes a predicate with a metadata query string.