EnterpriseDS Documentation

Class DSPhone​Number​Input​Mask

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."))
DSPhoneNumberInputMask DSPhoneNumberInputMask DSInputMask DSInputMask DSPhoneNumberInputMask->DSInputMask

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

keyboard​Type

public var keyboardType: UIKeyboardType?  

Only numbers are needed to enter a phone number.

Methods

raw​Text(from:​)

public func rawText(from text: String) -> String  

Raw numeric text.

should​Allow(replacement​String:​resulting​String:​)

public func shouldAllow(replacementString string: String, resultingString: String) -> Bool  

Only allow numeric digits.

apply​Formatting​Mask(to:​)

public func applyFormattingMask(to text: String) -> String