UI Components
UI Components
VGSTextField
An object that displays an editable text area in your interface.
Declaration
class VGSTextField: UIViewVGSTextField UI attributes
VGSTextField have similar attributes to native iOS UITextField attributes. To check full list of available attributes check VGSCollectSDK Reference Docs
VGSTextField Functional attributes
The VGSTextField class provide built-in support for input text validation and formatting. Each VGSTextField should be configured with VGSConfiguration or one of available tokenization configurations.
Attribute
Description
configuration
VGSConfiguration instance, specifies textfield required configuration
delegate
VGSTextFieldDelegate object that will handle text field editing process
state
read-only State instance, represent textfield's current parameters as isValid, isEmpty, etc.
To use all the power of VGSTextField you can track VGSTextField.state object and implement VGSTextFieldDelegate methods.
VGSTextField Accessibility attributes
Attribute
Description
textFieldAccessibilityLabel
String instance, localized string to identify the accessibility text field
textFieldAccessibilityHint
String instance, brief description of the result of performing an action on the accessibility text field
textFieldIsAccessibilityElement
Boolean value, determinates if the text field should be exposed as an accesibility element
VGSTextFieldDelegate
VGSTextFieldDelegate include functionality similar to native UITextFieldDelegate.
Declaration
Managing VGSTextField Editing process
Code example
VGSTextField UIResponder methods
Compare fields values
You have an option to compare two VGSTextFields. The result will be a Boolean value that represents whether the raw text in two textFelds is equal. All dividers and formatPatterns will be ignored in this function.
Code example
VGSExpDateTextField
An object that displays an editable text area, for use instead of a VGSTextField with FieldType.expDate when need to advanced expiration date options.
Declaration
Overview
VGSExpDateTextField inherits same functionality as default VGSTextField. In addition, VGSExpDateTextField provides an option to use date picker as input source instead of keyboard. Input source can be specified in VGSExpDateConfiguration.
Setting date visual format with picker view
• The date format displayed in the picker doesn't have impact on date format displayed in the field. SDK will automatically convert selected date when setting it into the field, based on the field formatPattern. • Date picker have limited valid expiration date range. Basicaly, it allows to set any date in future from current month plus 20 years. • If you need to collect date with long year format(MM/YYYY) you should update field .formatPattern and change default VGSValidationRuleCardExpirationDate rule in filed validation rules.
Code example
VGSDateTextField
An object that displays an editable text area, for use instead of a VGSTextField with FieldType.date when need to advanced date options.
Declaration
Overview
VGSDateTextField inherits same functionality as default VGSTextField. In addition, it provides an option to validate the date is in a specific range. It also allows to use date picker as input source instead of keyboard. Input source and date range can be specified in VGSDateConfiguration.
Setting month visual format with picker view
• The date format displayed in the picker doesn't have impact on date format displayed in the field. SDK will automatically convert selected date when setting it into the field, based on the field
formatPattern. • Date picker will use thedatePickerStartDateanddatePickerEndDatedates as limited valid range. If they are not supplied, it will use the default range as: -datePickerStartDate: Today minus 100 years. -datePickerEndDate: Today plus 100 years.\
Code example
VGSCardTextField
An object that displays an editable text area, for use instead of a VGSTextField when we need to detect and show credit card brand images.
Declaration
Overview
VGSCardTextField inherits the same functionality as the default VGSTextField. In addition, it detects the credit card brand while the user is typing data and displays the brand image in a text field. All card brand images are included in the SDK; however, you can still set your custom images.
Setting custom card brand images
Code example
VGSCVCTextField
An object that displays an editable text area, for use instead of a VGSTextField when need to show CVC icons for specific card brands.
Declaration
Overview
VGSCVCTextField inherits same functionality as default VGSTextField. In addition it displays CVC image. CVC image can change dynamically for specific card brand(e.g. CVC image for Amex contains 4 digits). CVC image files are included in the SDK, however you still can set your custom images.
Setting custom CVC images
Code example
For more details about available attributes and functionality check VGSCollectSDK Reference docs
Managing Payment Card Brands
By default, VGSCollectSDK supports a certain list of Payment Card Brands. For more accurate card brand detection and card number validation, you can edit default Payment Card Models or add a new Custom Payment Card Model. You can find a full list of default Payment Card Models supported by VGSCollectSDK in VGSPaymentCards class.
Customize Default Payment Card Models
When you need to change existing Payment Card Model attributes, you can do it by editing models in VGSPaymentCards. VGSPaymentCards contains the full list of predefined Payment Card Models and stores your Custom Payment Card Models.
You don't need to setup Payment Card Models every time you start collecting cards data flow. All the the changes will be available in the App for each
VGSCollectinstance. It's recommended to edit default Payment Card Models or add Custom Card Models once per App runtime.\
Didn't Find Supported Card Brand?
If you didn't find supported Payment Card Models by VGSCollectSDK you have two options: add your custom brand or validate all unknown card brands.
Add Custom Payment Card Models
You can add your own Payment Card Models to VGSPaymentCards.availableCards array.
Custom Payment Card Models have priority on Default Payment Card Model. That means if custom card model have same
regexas default card model, SDK will recognize card number as your Custom Brand.\
Validate Unknown Card Brands
In case if you want to validate all cards that not supported by VGSCollectSDK or that don't match your Custom Payment Card Models, you still can do it by enabling CardBrand.unknown validation and updating attributes in VGSPaymentCards.unknown object.
Set Valid Card Brands
You can choose which card brands you want to support in your Application. To do that, you need to setup VGSPaymentCards.validCardBrands array with CardBrans that should be detected as valid brand. When user enters card number that not related CardBrands from validCardBrands array, SDK will produce validation error. By default, validCardBrands include all your Custom Card Brands & Default Card Brands supported by SDK.
• Brands order is important. Order will define what CardBrand will be detected first. • If you need to use Custom Card Brands, you should add them to
validCardBrandsin accordance with required order. • If you need to edit default CardBrands*, this should be done before adding them intovalidCardBrandsarray.
Last updated

