Instance Method

evaluate(with:substitutionVariables:)

Returns a Boolean value indicating whether the specified object matches the conditions specified by the predicate after substituting in the values in a given variables dictionary.

Declaration

func evaluate(with object: Any?, substitutionVariables bindings: [String : Any]?) -> Bool

Parameters

object

The object against which to evaluate the predicate.

variables

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

Return Value

true if object matches the conditions specified by the predicate after substituting in the values in variables for any replacement tokens, otherwise false.

Discussion

This method returns the same result as the two step process of first invoking withSubstitutionVariables(_:) on the predicate and then invoking evaluate(with:) on the returned value. This method is optimized for situations which require repeatedly evaluating a predicate with substitution variables with different variable substitutions.

See Also

Evaluating a Predicate

func evaluate(with: Any?) -> Bool

Returns a Boolean value indicating whether the specified object matches the conditions specified by the predicate.

func allowEvaluation()

Forces a predicate that was securely decoded to allow evaluation.