VGSCVCTextField
@MainActor
public final class VGSCVCTextField : VGSTextField
An object that displays an editable text area. Can be use instead of a VGSTextField when need to show CVC/CVV images for credit card brands.
Overview:
VGSCVCTextField augments VGSTextField by rendering a brand-specific CVC/CVV helper icon whose size and position you can customize. When paired with a VGSCardTextField, the icon and validation rules adapt to the detected brand (e.g. 3 vs 4 digit CVC length).
Usage:
- Assign a
VGSConfigurationwithtype = .cvc(or tokenization config) before user input. - Optionally adjust
cvcIconLocation,cvcIconSize, or supply a custom image provider viacvcIconSource. - Keep accessibility hints descriptive but free of sensitive details.
Accessibility:
cvcIconViewIsAccessibilityElementcontrols VoiceOver exposure.- Use
cvcIconAccessibilityHintfor localized explanation: e.g. “CVC help icon”.
Security:
- Avoid logging or embedding confidential data inside accessibility strings.
-
Available CVC icon positions enum.
See moreDeclaration
Swift
public enum CVCIconLocation
-
CVC icon position inside
VGSCardTextField.Declaration
Swift
@MainActor public var cvcIconLocation: VGSCVCTextField.CVCIconLocation { get set } -
CVC icon size.
Declaration
Swift
@MainActor public var cvcIconSize: CGSize { get set } -
The natural size for the Textfield, considering only properties of the view itself.
Declaration
Swift
@MainActor public override var intrinsicContentSize: CGSize { get } -
CVC/CVV icon accessibility element flag. You can change the flag dynamically based on detected card brand. Default is true.
Declaration
Swift
@MainActor public var cvcIconViewIsAccessibilityElement: Bool { get set } -
CVC/CVV icon accessibility hint. Provide localized description of the icon purpose, not the code value.
Declaration
Swift
@MainActor public var cvcIconAccessibilityHint: String
-
Asks custom image for specific
VGSPaymentCards.CardBrandDeclaration
Swift
@MainActor public var cvcIconSource: ((VGSPaymentCards.CardBrand) -> UIImage?)?
View on GitHub