Initializer

init(block:)

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

Declaration

init(block: @escaping (Any?, [String : Any]?) -> Bool)

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 true if the evaluatedObject evaluates to true, otherwise false.

Return Value

A new predicate by that evaluates objects using block.

Discussion

In OS X v10.6, Core Data supports this method in the in-memory and atomic stores, but not in the SQLite-based store.

See Also

Creating a Predicate

init(format: String, argumentArray: [Any]?)

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

init(format: String, arguments: CVaListPointer)

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

func withSubstitutionVariables([String : Any])

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

init(value: Bool)

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