PredicateConstraint
public struct PredicateConstraint<T> : Constraint
A data type that links a Predicate
to an Error
that describes why the predicate evaluation has failed.
-
Declaration
Swift
public typealias InputType = T
-
Create a new
PredicateConstraint
instanceDeclaration
Parameters
predicate
A
Predicate
to describes the evaluation rule.error
A generic closure that dynamically builds an
Error
to describe why the evaluation has failed. -
Evaluates the input on the
Predicate
.Parameters
input
The input to be validated.
Return Value
.success
if the input is valid,.failure
containing theSummary
of the failingConstraint
s otherwise.