ValidatedType

public protocol ValidatedType

Allows behaviour to be added to a validated type via protocol extensions.

e.g., ~~~ typealias PhoneNumber = Validated

extension ValidatedType where ValidatorType == PhoneNumberValidator { var regionCode: String { return // Parse and return region code } }

let phoneNumber = try PhoneNumber(00 1 917 555 2368) print(\(phoneNumber.regionCode)) ~~~

  • The value that passes the defined Validator.

    If you are able to access this property; it means the ValidatorType.WrappedType passes the validator.

    Declaration

    Swift

    var value: ValidatorType.WrappedType