FWRegexValidator

struct FWRegexValidator : FWValidator

A validator that uses regexes to validation.

  • Description of the validator’s rule and how it behaves.

    Declaration

    Swift

    var validationRuleDescription: String
  • Regular expression used to validate entries.

    Declaration

    Swift

    let regexRule: String
  • Initializes a text based validator.

    Declaration

    Swift

    init(regex: String)

    Parameters

    regex

    The regular expression used as a validation rule.

  • Verifies if a given text is valid according to this validators rules.

    If there are no rules, it automatically accepts the text.

    Declaration

    Swift

    func validate(_ content: String) -> Bool

    Parameters

    content

    The text that will be validated.

    Return Value

    Boolean value indicating if the text was accepted by the rule.