AnyConstraint

public struct AnyConstraint<T> : Constraint

A type-erased Constraint.

  • 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 Constraint that wraps the given instance.

    Declaration

    Swift

    public init<C>(_ constraint: C) where T == C.InputType, C : Constraint
  • Evaluates the input against the receiver.

    Declaration

    Swift

    public func evaluate(with input: InputType) -> Result

    Parameters

    input

    The input to be validated.

    Return Value

    .success if the input is valid,.failure containing the Summary of the failing Constraints otherwise.