Class
DSCreditCardInputMask
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()
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 credit card number.
Methods
rawText(from:)
public func rawText(from text: String) -> String
Raw numeric text with no spaces, dashes or other separators
shouldAllow(replacementString:resultingString:)
public func shouldAllow(replacementString string: String, resultingString: String) -> Bool
Only allows numeric digits. All separators are added automatically.
applyFormattingMask(to:)
public func applyFormattingMask(to text: String) -> String