Skip to content

Structure

Validator

struct Validator<T> where T : Decodable, T : Sendable

Topics

Initializers

Instance Properties

Type Properties

  • alphanumeric
    Validates that all characters in elements of a [String] are alphanumeric (a-z,A-Z,0-9).
  • alphanumeric
    Validates that all characters in a String are alphanumeric (a-z,A-Z,0-9).
  • ascii
    Validates that all characters in elements of a [String] are ASCII (bytes 0..<128).
  • ascii
    Validates that all characters in a String are ASCII (bytes 0..<128).
  • email
    Validates whether a String is a valid email address.
  • empty
    Validates that the data is empty. You can also check a non empty state by negating this validator: !.empty.
  • internationalEmail
  • nil
    Validates that the data is nil. Combine with the not-operator ! to validate that the data is not nil.
  • url
    Validates whether a String is a valid URL.
  • valid
    Validates nothing. Can be used as placeholder to validate successful decoding

Type Methods

  • case(of:)
    Validates that the data can be converted to a value of an enum type with iterable cases.
  • characterSet(_:)
    Validates that all characters in a String are in the supplied CharacterSet.
  • count(_:)
    Validates that the data’s count is within the supplied ClosedRange.
  • custom(_:validationClosure:)
    Validates whether a String matches a RegularExpression pattern
  • in(_:)
    Validates whether an item is contained in the supplied array.
  • pattern(_:)
    Validates whether a String matches a RegularExpression pattern
  • range(_:)
    Validates that the data is within the supplied ClosedRange.

Relationships

Conforms To

  • Swift.Sendable
  • Swift.SendableMetatype