AsyncConstraint
public protocol AsyncConstraint<InputType, ErrorType>
The AsyncConstraint
protocol is used to define the structure that must be implemented by concrete asynchronous constraints.
-
A type that provides information about what kind of values the constraint can be evaluated with.
Declaration
Swift
associatedtype InputType
-
An error type that provides information about why the evaluation failed.
Declaration
Swift
associatedtype ErrorType : Error
-
Asynchronous evaluates the input on the provided queue.
Declaration
Parameters
input
The input to be validated.
queue
The queue on which the completion handler is executed.
completionHandler
The completion handler to call when the evaluation is complete. It takes a
Bool
parameter:result
.success
if the input is valid,.failure
containing theSummary
of the failingConstraint
s otherwise. -
evaluate(with:
Asynchronous) Asynchronous evaluates the input against the receiver.
Parameters
input
The input to be validated.
Return Value
.success
if the input is valid,.failure
containing theSummary
of the failingConstraint
s otherwise. -
check(_:
Default implementation, asynchronous) Asynchronous evaluates the input against the receiver. When the evaluation is successful, it return the
input
, otherwise it throws theSummary
of the failingConstraint
.Default Implementation
Asynchronous evaluates the input against the receiver. When the evaluation is successful, it return the
input
, otherwise it throws theSummary
of the failingConstraint
.Throws
TheSummary
of the failingConstraint
s when the validation fails.Parameters
input
The input to be validated.
Return Value
The
input
when the validation is successful.