UITextField

  • Regular exp for email

    Declaration

    Swift

    static let emailRegex = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"
  • Automatically sets these values: backgroundColor = clearColor, textColor = ThemeNicknameColor, clipsToBounds = true, textAlignment = Left, userInteractionEnabled = true, editable = false, scrollEnabled = false, font = ThemeFontName

    Declaration

    Swift

    public convenience init(x: CGFloat, y: CGFloat, w: CGFloat, h: CGFloat, fontSize: CGFloat)
  • Add left padding to the text in textfield

    Declaration

    Swift

    public func addLeftTextPadding(_ blankSize: CGFloat)
  • Add a image icon on the left side of the textfield

    Declaration

    Swift

    public func addLeftIcon(_ image: UIImage?, frame: CGRect, imageSize: CGSize)
  • Ways to validate by comparison

    See more

    Declaration

    Swift

    enum textFieldValidationOptions: Int
  • Validation length of character counts in UITextField

    Declaration

    Swift

    func validateLength(ofCount count: Int, option: UITextField.textFieldValidationOptions) -> Bool
  • Undocumented

    Declaration

    Swift

    func validateEmail() -> Bool
  • Validation of digits only

    Declaration

    Swift

    func validateDigits() -> Bool