Class
DSPhoneNumberInputMask
public class DSPhoneNumberInputMask: DSInputMask
An input mask, when assigned to a DSTextField, will enforce use of a number pad for text entry and allows only digits to be entered and formatted. Only 10-digit phone numbers are allowed.
It's recommended to use the DSPhoneNumberValidationRule along with this mask.
let textField = DSTextField()
textField.inputMask = DSPhoneNumberInputMask()
textField.addValidationRule(DSPhoneNumberValidationRule(message: "Phone Number is incorrect."))
Relationships
Conforms To
DSInputMask
A masking object that controls what can be legally typed into a DSTextField and handles type formatting while that typing takes place. They do not validate but often "partner" up with validation rules.
Initializers
init()
public init()
Properties
keyboardType
public var keyboardType: UIKeyboardType?
Only numbers are needed to enter a phone number.
Methods
shouldAllow(replacementString:resultingString:)
public func shouldAllow(replacementString string: String, resultingString: String) -> Bool
Only allow numeric digits.
applyFormattingMask(to:)
public func applyFormattingMask(to text: String) -> String