Latest 1.3.0
License MIT
Platforms ios 8.0


Engaging credit card form that is simple to use.




To use LSCreditCardForm, simply add LSCreditCardFormView into your view controller and layout apropriately.
Contents of LSCreditCardFormView are dynamicaly resized and layout is updated on each view size change.
Use LSCreditCardFormDelegate to get values user entered into the form. Delegate protocol contains only one method
didCompleteForm(creditCard: LSCreditCard) that is called whenever user hits Done button. Library does not validate
entered data except making sure that user did not enter invalid characters.

LSCreditCardFormView currently detects following credit card issuers:


Various aspects of form can be customized using LSCreditCardFormConfig and it’s subfields. Customization points include fonts, text colors,
background colors and ability to provide custom credit card images.
IMPORTANT: all customizations have to be made before LSCreditCardFormView gets instantiated

Textfield focus automatically changes when user enters maximum allowed number of characters. This works well in most cases, but causes
problems with VISA cards. Maximum number of digits for VISA credit cards is 19, but vast majority of cards consist of only 16 digits.
This would make entering VISA cards annoying so config has CreditCard.softLimitVisaTo16Digits that can be set to true
to automatically skip to next textfield when user enters 16th digit. In rare cases when user wants to enter 19 digits, he can manually return
to number text field.

If you wish to limit which credit cards get detected, override CreditCard.supportedTypes property by providing array of types you
want to detect. User will still be able to enter any credit card number, disabling detection for certain types simply means that the credit
card image will not update and will remain on "unknown" credit card.

Custom types

You can supply detection of and images for additional credit card types. Use delegate method func getCustomCardType(for number: String) -> LSCreditCardType?
to check if CC number belongs to your custom type. Return nil if it doesn’t, to have library do the default type detection. You also should
provide images for your new type using LSCreditCardFormConfig.CreditCard.imgBackForCustomType and LSCreditCardFormConfig.CreditCard.imgFrontForCustomType
callbacks. See example project for more details.
Currently, only custom images are supported, you can’t provide custom number length and formatting, default 4-4-4-4 is used for all custom types.


If you wish to have keyboard open as soon as the view appears with new view controller, call becomeFirstResponder on LSCreditCardFormView.


LSCreditCardForm is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'LSCreditCardForm'

Using LSCreditCardView outside of the LSCreditCardForm

If you want to display credit card view in your app, you can. First create instance of LSCreditCardView and add it into your view hierarchy.
Create instance of LSCreditCard and feed it CC number, card holder name, expiration date string and type and call updateValues(creditCard:)
on your LSCreditCardView instance.


LSCreditCardForm is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "LSCreditCardForm",
    "version": "1.3.0",
    "summary": "Simple and engaging credit card form",
    "description": "Offer your users engaging way how to enter credit card detail. Task that is usually boring and bothersome can be lightened by presenting it in visually interesting way",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "lopdo": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.3.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "LSCreditCardForm/Classes/**/*",
    "resources": [

Pin It on Pinterest

Share This