-
Creates a
AndConstrainttype with an array of child constraint types and a set ofGroups to group by.Declaration
Swift
case and(_: [`Self`], groups: Set<Group> = .init())Parameters
constraintTypesAn array of child constraint types.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
BlankConstrainttype with a custom error message and a set ofGroups to group by.Declaration
Swift
case blank(_: String = BlankConstraint.message, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates an
BoolConstrainttype with a custom error message and a set ofGroups to group by.Declaration
Swift
case bool(_: String = BoolConstraint.message, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
ChoiceConstrainttype with a list of choices, a custom error message and a set ofGroups to group by.Declaration
Swift
case choice( _ choices: [any Encodable & Equatable] = .init(), message: String = ChoiceConstraint.message, groups: Set<Group> = .init() )Parameters
choicesA list of choices. Defaults to an empty array.
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
DateConstrainttype with a customDateFormatter, a custom error message and a set ofGroups to group by.Declaration
Swift
case date( _ dateFormatter: DateFormatter = .iso8601, message: String = DateConstraint.message, groups: Set<Group> = .init() )Parameters
dateFormatterA custom
DateFormatter. Defaults to the “iso8601”DateFormatter.messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates an
EmailConstrainttype with a custom error message and a set ofGroups to group by.Declaration
Swift
case email(_: String = EmailConstraint.message, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates an
IntegerConstrainttype with minimum/maximum values, custom minimum/maximum error messages, and a set ofGroups to group by.Declaration
Swift
case integer( min: Int = IntegerConstraint.min, max: Int = IntegerConstraint.max, minMessage: String = IntegerConstraint.minMessage, maxMessage: String = IntegerConstraint.maxMessage, exactMessage: String = IntegerConstraint.exactMessage, groups: Set<Group> = .init() )Parameters
minA custom minimum value. Defaults to the default minimum value.
maxA custom maximum value. Defaults to the default maximum value.
minMessageA custom error message to show for a minimum value violation. Defaults to the default minimum value violation error message.
maxMessageA custom error message to show for a maximum value violation. Defaults to the default maximum value violation error message.
exactMessageA custom error message to show for an exact value violation. Defaults to the default exact value violation error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates an
IPConstrainttype with a custom error message and a set ofGroups to group by.Declaration
Swift
case ip(_: String = IPConstraint.message, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
JSONConstrainttype with a custom error message and a set ofGroups to group by.Declaration
Swift
case json(_: String = JSONConstraint.message, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
LengthConstrainttype with minimum/maximum values, custom minimum/maximum error messages, and a set ofGroups to group by.Declaration
Swift
case length( min: UInt = LengthConstraint.min, max: UInt = LengthConstraint.max, minMessage: String = LengthConstraint.minMessage, maxMessage: String = LengthConstraint.maxMessage, exactMessage: String = LengthConstraint.exactMessage, groups: Set<Group> = .init() )Parameters
minA custom minimum value. Defaults to the default minimum value.
maxA custom maximum value. Defaults to the default maximum value.
minMessageA custom error message to show for a minimum value violation. Defaults to the default minimum value violation error message.
maxMessageA custom error message to show for a maximum value violation. Defaults to the default maximum value violation error message.
exactMessageA custom error message to show for an exact value violation. Defaults to the default exact value violation error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
NotBlankConstrainttype with a custom error message and a set ofGroups to group by.Declaration
Swift
case notBlank(_: String = NotBlankConstraint.message, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
OrConstrainttype with an array of child constraint types and a set ofGroups to group by.Declaration
Swift
case or(_: [`Self`], groups: Set<Group> = .init())Parameters
constraintTypesAn array of child constraint types.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
RegexConstrainttype with a regular expression pattern, a custom error message and a set ofGroups to group by.Declaration
Swift
case regex( _ pattern: String = RegexConstraint.pattern, message: String = RegexConstraint.message, groups: Set<Group> = .init() )Parameters
patternA regular expression pattern. Matches to any character(s) or an empty string by default.
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
URLConstrainttype with a file URL flag, a custom error message, and a set ofGroups to group by.Declaration
Swift
case url(_: String = URLConstraint.message, isFileURL: Bool = false, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
isFileURLIndicates whether it is a file URL or not. Defaults to
false.groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
UUIDConstrainttype with a custom error message and a set ofGroups to group by.Declaration
Swift
case uuid(_: String = UUIDConstraint.message, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
Creates a
VINConstraintwith a custom error message and a set ofGroups to group by.Declaration
Swift
case vin(_: String = VINConstraint.message, groups: Set<Group> = .init())Parameters
messageA custom error message. Defaults to the default error message.
groupsA set of
Groups to group by. Defaults to an empty set. -
A matching
Constraintfor aConstraintType.Declaration
Swift
public var constraint: Constraint { get }
View on GitHub
Install in Dash