AnyAsyncConstraint

public struct AnyAsyncConstraint<T> : AsyncConstraint

A type-erased AsyncConstraint.

  • A type that provides information about what kind of values the constraint can be evaluated with.

    Declaration

    Swift

    public typealias InputType = T
  • Creates a type-erased AsyncConstraint that wraps the given instance.

    Declaration

    Swift

    public init<C>(_ constraint: C) where T == C.InputType, C : AsyncConstraint
  • Asynchronous evaluates the input on the provided queue.

    Declaration

    Swift

    public func evaluate(with input: InputType, queue: DispatchQueue, completionHandler: @escaping (_ result: ValidationResult) -> Void)

    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 the Summary of the failing Constraints otherwise.