TextFieldValidator

public final class TextFieldValidator
extension TextFieldValidator: TextFieldValidation

Class for text field validation, includes logic for validation and error text selection. Contains predefined texts for errors. You can add you own error text! In this case you must set text for error in public properties. Or you can set global message for all errors (use ‘globalErrorMessage’ in constructor)

Properties

  • Text for error, when input string does not exist

    Declaration

    Swift

    public var emptyErrorText: String?
  • Text for error, when input string too short (< minLength)

    Declaration

    Swift

    public var shortErrorText: String?
  • Text for error, when input string too big (> maxLength)

    Declaration

    Swift

    public var largeErrorText: String?
  • Text for error, when input string does not match a regular expression

    Declaration

    Swift

    public var notValidErrorText: String?

Initialization

TextFieldValidation

  • Undocumented

    Declaration

    Swift

    public func validate(_ text: String?) -> (isValid: Bool, errorMessage: String?)