prolificinteractive / Caishen

A Payment Card UI & Validator for iOS
MIT License
766 stars 119 forks source link

I can't change the card number separator #95

Closed welove closed 7 years ago

welove commented 8 years ago

I can't change the card number separator.

i tried: cardTextField.numberInputTextField.cardNumberSeparator = "-" and: cardTextField.cardNumberSeparator = "-"

i get the following error: Thread 1: EXC_BAD_ACCESS at CardNumberFormater.swift in public func format(cardNumber: String) -> String on the following line: regex = try NSRegularExpression(pattern: pattern, options: NSRegularExpression.Options())

DannyVancura commented 8 years ago

Hi @welove, thank you for reporting this issue! I tried to reproduce this bug on the Example project but it didn't crash for me with the lines that you posted above. Can you to share more information about how you set up Caishen and what you did when you ran into this issue please? Like:

A code snippet of your setup for the text field would be best!

Thanks, Daniel

welove commented 8 years ago

Hi Danny, here is full my code:

cardTextField = CardTextField(frame: CGRect(x: 15, y: 5, width: cardBgView.frame.size.width-30, height: 30))
cardTextField.placeholder = NSLocalizedString("New Credit Card", comment: "")
cardTextField.cardTextFieldDelegate = self
cardTextField.numberInputTextField.cardNumberSeparator = "-"
cardBgView.addSubview(cardTextField)

Just tested it out, and If i comment/delete the placeholder line, it works.