EnterpriseDS Documentation

Class DSCredit​Card​Input​Mask

public class DSCreditCardInputMask: DSInputMask  

An input mask, when assigned to a DSTextField, will enforce use of a number pad for text entry and format credit card numbers if it recognizes the brand of the card being entered. (e.g. Visa, Mastercard, etc.)

It will also limit the number of characters based on the same rules.

let textField = DSTextField()

textField.inputMask = DSCreditCardInputMask()
DSCreditCardInputMask DSCreditCardInputMask DSInputMask DSInputMask DSCreditCardInputMask->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 credit card number.

Methods

raw​Text(from:​)

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

Raw numeric text with no spaces, dashes or other separators

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

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

Only allows numeric digits. All separators are added automatically.

apply​Formatting​Mask(to:​)

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