ChoiceConstraint
public struct ChoiceConstraint : Constraint
A constraint to validate if a value exists in predefined choices.
-
A default error message to show if no custom error message is provided.
Declaration
Swift
public static let message: String -
A list of choices.
Declaration
Swift
public let choices: [any Encodable & Equatable] -
A custom error message.
Declaration
Swift
public let message: String -
See
Constraint.Declaration
Swift
public let groups: Set<Group> -
A validator named
ChoiceValidatorto validate a value.Declaration
Swift
public let validator: ConstraintValidator -
Initializes a new instance with a list of choices, a custom error message and a set of
Groups to group by.Declaration
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.
View on GitHub
Install in Dash