ConstraintValidator
public protocol ConstraintValidator
A common protocol for all Constraint validators.
-
Validates a primitive
Encodablevalue against aConstraintwith default parameters.Throws
AValidator.Errorif the value is not of primitive type or aConstraintViolationif the value doesn’t satisfy aConstraint.Declaration
Swift
func validate(_ value: Encodable?) throwsParameters
valueA primitive
Encodablevalue to be validated. -
Validates a primitive
Encodablevalue against aConstraintwith custom parameters.Throws
AValidator.Errorif the value is not of primitive type or aConstraintViolationif the value doesn’t satisfy aConstraint.Declaration
Swift
func validate(_ value: Encodable?, against constraint: Constraint) throwsParameters
valueA primitive
Encodablevalue to be validated.constraintAn instance of
Constraintwith custom parameters.
View on GitHub
Install in Dash