public struct DSCreditCard
A credit card that identifies properties of various brand types, performs validation, and can perform formatting of their numbers.
let creditCard = DSCreditCard(number: "4111111111111111") print(creditCard.isValid) print(creditCard.formattedNumber)
public init(number: String)
Initializes and returns a newly allocated CreditCard based on the number.
A credit card number
public private(set) var cardType: DSCreditCardType
The type of credit card, identified as best as possible, based on a number.
public private(set) var number: String
The raw credit card number.
public var isValid: Bool
Returns true if the card number's brand is identifiable, and valid to those constraints, or if the brand is not identified and has a length greater than 0.
public var formattedNumber: String
Returns the properly formatted card number if its brand is identified. (e.g. Visa, Mastercard, etc.)