Structure
Validator
struct Validator<T> where T : Decodable, T : Sendable
Topics
Initializers
Instance Properties
Type Properties
static var alphanumeric: Validator<Array<String>>Validates that all characters in elements of a[String]are alphanumeric (a-z,A-Z,0-9).static var alphanumeric: Validator<String>Validates that all characters in aStringare alphanumeric (a-z,A-Z,0-9).static var ascii: Validator<Array<String>>Validates that all characters in elements of a[String]are ASCII (bytes 0..<128).static var ascii: Validator<String>Validates that all characters in aStringare ASCII (bytes 0..<128).static var email: Validator<String>Validates whether aStringis a valid email address.static var empty: Validator<T>Validates that the data is empty. You can also check a non empty state by negating this validator:!.empty.static var internationalEmail: Validator<String>static var `nil`: Validator<T>Validates that the data isnil. Combine with the not-operator!to validate that the data is notnil.static var url: Validator<String>Validates whether aStringis a valid URL.static var valid: Validator<T>Validates nothing. Can be used as placeholder to validate successful decoding
Type Methods
static func `case`<E>(of: E.Type) -> Validator<T>Validates that the data can be converted to a value of an enum type with iterable cases.static characterSet(_:)Validates that all characters in aStringare in the suppliedCharacterSet.static count(_:)Validates that the data’s count is within the suppliedClosedRange.static func custom(String, validationClosure: (T) -> Bool) -> Validator<T>Validates whether aStringmatches a RegularExpression patternstatic `in`(_:)Validates whether an item is contained in the supplied array.static func pattern(String) -> Validator<T>Validates whether aStringmatches a RegularExpression patternstatic range(_:)Validates that the data is within the suppliedClosedRange.
Relationships
Conforms To
Swift.SendableSwift.SendableMetatype