FormatTextField

open class FormatTextField: UITextField

The FormatTextField provides formatted UITextField.

Attention

Using the UITextFieldDelegate should NOT be used on this class. Use the FormatTextFieldDelegate protocol (which implements all the methods of the UITextFieldDelegate protocol instead).
  • The delegate that will recieve events relating to this FormatTextField.

    Declaration

    Swift

    public final var formatTextFieldDelegate: FormatTextFieldDelegate?
  • The input type of the

    Note

    Chaning the input type will trigger the delegates formatTextFieldTextChange method.

    Declaration

    Swift

    public final var inputType: FormatTextField.InputType = .none
  • The formatted text. Simply the text that is displayed to the user. This will work even if a UITextFieldDelegate is used on this class.

    Declaration

    Swift

    public var formattedText: String
  • The clensed text that removes all formatting characters. For instance, the parenthesis on a phone number.

    Declaration

    Swift

    public var clensedText: String
  • Whether the input is valid for the particular input type.

    Declaration

    Swift

    public var isValid: Bool
  • Sets the text in the text field. Text passed through will be clensed and formatted.

    Declaration

    Swift

    public final func set(text t: String)

    Parameters

    text

    The text to be put into the text field.

  • The input type for a given

    See more

    Declaration

    Swift

    public enum InputType
  • Uses the method to update the text of the text based on the inputType. One should use the formatTextFieldDelegates formatTextFieldTextChange to get notified when this method is called. Always returns true as the text change is handled based on the input type.

    Declaration

    Swift

    public final func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool