UITextField

public extension UITextField
  • SwifterSwift: UITextField text type.

    • emailAddress: UITextField is used to enter email addresses.
    • password: UITextField is used to enter passwords.
    • generic: UITextField is used to enter generic text.
    See more

    Declaration

    Swift

    enum TextType

Properties

  • SwifterSwift: Set textField for common text types.

    Declaration

    Swift

    var textType: TextType { get set }
  • SwifterSwift: Check if text field is empty.

    Declaration

    Swift

    var isEmpty: Bool { get }
  • SwifterSwift: Return text with no spaces or new lines in beginning and end.

    Declaration

    Swift

    var trimmedText: String? { get }
  • SwifterSwift: Check if textFields text is a valid email format.

    textField.text = "[email protected]"
    textField.hasValidEmail -> true
    
    textField.text = "swifterswift"
    textField.hasValidEmail -> false
    

    Declaration

    Swift

    var hasValidEmail: Bool { get }
  • SwifterSwift: Left view tint color.

    Declaration

    Swift

    @IBInspectable
    var leftViewTintColor: UIColor? { get set }
  • SwifterSwift: Right view tint color.

    Declaration

    Swift

    @IBInspectable
    var rightViewTintColor: UIColor? { get set }

Methods

  • SwifterSwift: Clear text.

    Declaration

    Swift

    func clear()
  • SwifterSwift: Set placeholder text color.

    Declaration

    Swift

    func setPlaceHolderTextColor(_ color: UIColor)

    Parameters

    color

    placeholder text color.

  • SwifterSwift: Add padding to the left of the textfield rect.

    Declaration

    Swift

    func addPaddingLeft(_ padding: CGFloat)

    Parameters

    padding

    amount of padding to apply to the left of the textfield rect.

  • SwifterSwift: Add padding to the left of the textfield rect.

    Declaration

    Swift

    func addPaddingLeftIcon(_ image: UIImage, padding: CGFloat)

    Parameters

    image

    left image

    padding

    amount of padding between icon and the left of textfield