Samples
VGS Show iOS SDK Samples
Check samples and code examples how to use VGS Show SDK features.
Text Formatting in VGSLabel
You have an option to transform the revealed text with specified pattern in addTransformationRegex(_:) function.
Code example
/// Option 1. Card Number formatting
// Create regex object, split card number to XXXX XXXX XXXX XXXX format.
let cardNumberPattern = "(\\d{4})(\\d{4})(\\d{4})(\\d{4})"
let template = "$1 $2 $3 $4"
// Use force try! here for sample.
let regex = try! NSRegularExpression(pattern: cardNumberPattern, options: [])
// Add transformation regex and template to your label.
cardNumberLabel.addTransformationRegex(regex, template: template)
/// Option 2. Social Security Number formatting
// Create regex object, split SSN to XXX-XX-XXXX format.
let ssnPattern = "(\\d{3})(\\d{2})(\\d{4})"
let template = "$1 $2 $3"
// Use force try! here for sample.
let regex = try! NSRegularExpression(pattern: ssnPattern, options: [])
// Add transformation regex and template to your label.
ssnLabel.addTransformationRegex(regex, template: template)Secure text in VGSLabel
You can hide revealed text with secureTextSymbol fully or partially. Check the code examples how to add an option for your users to show/hide revealed data.
Code example
Last updated

