FUIPhoneNumberFormatter

open class FUIPhoneNumberFormatter : FUIFormattedStringEditing

A FUIFormattedStringEditing implementation to format phone number.

This formatter accepts only digit characters 0 through 9. All other characters user typed are ignored.

The default format is (###) ###-####. Which correspond to US phone number system. Developer could change the format to fit phone number for other countries.

  • The format string of the phone number.

    The default format is (###) ###-####. Each ‘#’ character will be replaced by a digit character user entered. Other characters in the format string are considered as format characters and are displayed as needed depending on the position and the numbers in the string.

    For example, when the original string is 1234567890, the formatted string will be (123) 456-7890 using the default format string. Or, when the original string is 12345, the resulting formatted string is (123) 45.

    The number of digits user can enter is the total number of ‘#’ characters in the format string.

    Declaration

    Swift

    public var format: String { get set }
  • The constructor.

    Declaration

    Swift

    public init()