BTUIKCardType

Objective-C

@interface BTUIKCardType : NSObject

Swift

class BTUIKCardType : NSObject

Immutable card type

  • Obtain the BTCardType for the given brand, or nil if none is found

    Declaration

    Objective-C

    + (instancetype)cardTypeForBrand:(NSString *)brand;

    Swift

    convenience init!(forBrand brand: String!)
  • Obtain the BTCardType for the given number, or nil if none is found

    Declaration

    Objective-C

    + (instancetype)cardTypeForNumber:(NSString *)number;

    Swift

    convenience init!(forNumber number: String!)
  • Return all possible card types for a number

    Declaration

    Objective-C

    + (NSArray *)possibleCardTypesForNumber:(NSString *)number;

    Swift

    class func possibleCardTypes(forNumber number: String!) -> [Any]!
  • Check if a number is valid

    Declaration

    Objective-C

    - (BOOL)validNumber:(NSString *)number;

    Swift

    func validNumber(_ number: String!) -> Bool
  • Check if a number is complete

    Declaration

    Objective-C

    - (BOOL)completeNumber:(NSString *)number;

    Swift

    func completeNumber(_ number: String!) -> Bool
  • Check is a number is valid and necessarily complete (i.e. it can’t get any longer)

    Declaration

    Objective-C

    - (BOOL)validAndNecessarilyCompleteNumber:(NSString *)number;

    Swift

    func validAndNecessarilyCompleteNumber(_ number: String!) -> Bool
  • Check if the CVV is valid for a BTCardType

    Declaration

    Objective-C

    - (BOOL)validCvv:(NSString *)cvv;

    Swift

    func validCvv(_ cvv: String!) -> Bool
  • Format a number based on type Does NOT validate

    Declaration

    Objective-C

    - (NSAttributedString *)formatNumber:(NSString *)input;

    Swift

    func formatNumber(_ input: String!) -> NSAttributedString!
  • Undocumented

    Declaration

    Objective-C

    - (NSAttributedString *)formatNumber:(NSString *)input kerning:(CGFloat)kerning;

    Swift

    func formatNumber(_ input: String!, kerning: CGFloat) -> NSAttributedString!
  • Max number of characters allowed for a card number

    Declaration

    Objective-C

    + (NSUInteger)maxNumberLength;

    Swift

    class func maxNumberLength() -> UInt
  • The card’s brand

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *brand;

    Swift

    var brand: String! { get }
  • An array of valid number prefixes

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray *validNumberPrefixes;

    Swift

    var validNumberPrefixes: [Any]! { get }
  • An array of relaxed valid number prefixes

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray *relaxedPrefixes;

    Swift

    var relaxedPrefixes: [Any]! { get }
  • The valid card number lengths

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSIndexSet *validNumberLengths;

    Swift

    var validNumberLengths: IndexSet! { get }
  • The valid CVV length

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger validCvvLength;

    Swift

    var validCvvLength: UInt { get }
  • An array representing the spacing in the card number Ex: @[@4, @8, @12, @16]

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray *formatSpaces;

    Swift

    var formatSpaces: [Any]! { get }
  • Max length of the card number

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger maxNumberLength;

    Swift

    var maxNumberLength: UInt { get }
  • Brand-specific name for card security code

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *securityCodeName;

    Swift

    unowned(unsafe) var securityCodeName: NSString! { get }