URLConstraint

public struct URLConstraint : Constraint

A constraint to validate if a value is URL.

  • A default error message to show if no custom error message is provided.

    Declaration

    Swift

    public static let message: String
  • Indicates whether it is a file URL or not.

    Declaration

    Swift

    public let isFileURL: Bool
  • A custom error message.

    Declaration

    Swift

    public let message: String
  • See Constraint.

    Declaration

    Swift

    public let groups: Set<Group>
  • A validator named URLValidator to validate a value.

    Declaration

    Swift

    public let validator: ConstraintValidator
  • Initializes a new instance with a file URL flag, a custom error message, and validation groups to be applied.

    Declaration

    Swift

    public init(_ message: String = message, isFileURL: Bool = false, groups: Set<Group> = .init())

    Parameters

    message

    A custom error message. Defaults to a default error message.

    isFileURL

    Indicates whether it is a file URL or not. Defaults to false.

    groups

    Validation groups to be applied. Defaults to an empty array.