FormatTextField
open class FormatTextField: UITextField
The FormatTextField provides formatted UITextField.
Attention
Using theUITextFieldDelegate 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 delegatesformatTextFieldTextChangemethod.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
UITextFieldDelegateis 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
textThe text to be put into the text field.
-
Uses the method to update the text of the text based on the
inputType. One should use theformatTextFieldDelegatesformatTextFieldTextChangeto 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
-
Calls the corresponding method on the
formatTextFieldDelegate. And if true, will update the text based on theinputType.Declaration
Swift
public final func textFieldShouldClear(_ textField: UITextField) -> Bool -
Calls the corresponding method on the
formatTextFieldDelegate.Declaration
Swift
public final func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool -
Calls the corresponding method on the
formatTextFieldDelegate.Declaration
Swift
public final func textFieldDidBeginEditing(_ textField: UITextField) -
Calls the corresponding method on the
formatTextFieldDelegate.Declaration
Swift
public final func textFieldShouldEndEditing(_ textField: UITextField) -> Bool -
Calls the corresponding method on the
formatTextFieldDelegate.Declaration
Swift
public final func textFieldDidEndEditing(_ textField: UITextField, reason: UITextFieldDidEndEditingReason) -
Calls the corresponding method on the
formatTextFieldDelegate.Declaration
Swift
public final func textFieldDidEndEditing(_ textField: UITextField) -
Calls the corresponding method on the
formatTextFieldDelegate.Declaration
Swift
public final func textFieldShouldReturn(_ textField: UITextField) -> Bool
FormatTextField Class Reference