ValidationResult

public enum ValidationResult<Value, Error: Swift.Error>

Represents the result of the validation performed by a validating property.

  • The proposed value is valid.

    Declaration

    Swift

    case valid(Value)
  • The proposed value is invalid, but the validator was able to coerce it into a replacement which it deemed valid.

    Declaration

    Swift

    case coerced(replacement: Value, proposed: Value, error: Error?)
  • The proposed value is invalid.

    Declaration

    Swift

    case invalid(Value, Error)
  • Whether the value is invalid.

    Declaration

    Swift

    public var isInvalid: Bool
  • Extract the valid value, or nil if the value is invalid.

    Declaration

    Swift

    public var value: Value?
  • Extract the error if the value is invalid.

    Declaration

    Swift

    public var error: Error?