UI Components

Your app's user interface and everything that users can see and interact with.

VGSLabel

A user interface element that displays any revealed text to the user.

VGSLabel configuration

Set contentPath for VGSLabel view as identifier for Reveal operations on Inbound routes. Check more details how to show revealed data here.

Code example

cardNumberLabel.contentPath = "<CONTENT_PATH_NAME_1>"
expDateLabel.contentPath = "<CONTENT_PATH_NAME_2>"

Set UI configurations for VGSLabel view.

Code example

private func configureUI() {
    let paddings = UIEdgeInsets.init(top: 8, left: 8, bottom: 8, right: 8)
    let textColor = UIColor.white
    let borderColor = UIColor.clear
    let font = UIFont.systemFont(ofSize: 20)
    let backgroundColor = UIColor.systemBlue
    let cornerRadius: CGFloat = 0
    let textAlignment = NSTextAlignment.left
    let characterSpacing: CGFloat = 0.83

    // Text color.
    cardNumberLabel.textColor = textColor

    // Paddings - should be non-negative!.
    cardNumberLabel.paddings = paddings

    // Border color.
    cardNumberLabel.borderColor = borderColor

    // Font.
    cardNumberLabel.font = font

    // Background color.
    cardNumberLabel.backgroundColor = backgroundColor

    // Corner radius.
    cardNumberLabel.layer.cornerRadius = cornerRadius

    // Text alignment.
    cardNumberLabel.textAlignment = textAlignment

    // Character spacing.
    cardNumberLabel.characterSpacing = characterSpacing
}

Placeholder

You can setup placeholder for VGSLabel. Placeholder is displayed in label when there is no revealed text to show. Placeholder style can be customized with placeholderStyle property.

By default VGSLabel placeholder has paddings from VGSLabel text paddings property. Custom placeholder paddings can be specified with placeholderPaddings. Paddings should contain non-negative values. Negative paddings will be ignored.

Data formatting

You have ability to format received data or value in VGSLabel view. Use addTransformationRegex(_:) to setup custom transformation NSRegularExpression object and replacement template for text formatting. Use try/catch to validate your custom regular expression.

You can apply multiple NSRegularExpression objects for formatting. Final text will be a result of the subsequent transformations.\

Handle changes in VGSLabel

You can handle changes in VGSLabel view setting its delegate property to object implementing VGSLabelDelegate protocol.

Code example

Secure text

VGS Show SDK provides you an option to secure text in VGSLabel. By secure we mean that you can optionally replace all or only some characters in revealed string by secure symbol. This works similar to "password mode" that you could see in UITextFields.

• Secure text is applied to visible text in VGSLabel. You should take it into consideration you apply tranformationRegex to revealed data, ranges should be valid for modified string. • At the moment, secureTextSymbol can be only one character symbol. • Inappropriate text ranges will be ignored. Inappropriate text ranges are range where start > end or start < 0.\

Copy text to clipboard

You can provide an option for your end-users to copy revealed text to the clipboard after the request. Use copyTextToClipboard(_:) for VGSLabel to copy revealed text. The default option is .raw to copy raw revealed text without applying any custom formatting. You can also use .transformed the option to copy formatted text.

Clear text

You have an option to clear text from VGSLabel with clearText(_:) function. Placeholder will be displayed in the label after clear text (if placeholder is configured).

After clearText(_:) new VGSShow request will required to populate label with revealed data. Please use this method carefully.

VGSLabel Accessibility attributes

Attribute

Description

vgsAccessibilityLabel

String instance, localized string to identify the accessibility label

vgsAccessibilityHint

String instance, brief description of the result of performing an action on the accessibility label

vgsIsAccessibilityElement

Boolean value, determinates if the label should be exposed as an accesibility element

VGSPDFView

A user interface element that displays a revealed PDF document to the user.

VGSPDFView is available only from iOS 11 since it is built upon Apple PDFKitarrow-up-right\

VGSPDFView configuration

Set contentPath for VGSPDFView view as an identifier for Reveal operations on Inbound routes. Check more details on how to show revealed data here.

Code example

Set UI configurations for VGSPDFView instance.

Reveal PDF with VGSShowSDK

Revealing PDF files might take more time than for text data. Consider your PDF file size and specify an additional request timeout VGSShowRequestOptions if needed. The maximum file size that can be sent to VGS is 24Mbarrow-up-right.

Revealing invalid base64 data or invalid pdf data will produce an error.>

Handle changes in VGSPDFView

You can handle changes in VGSPDFView view setting its delegate property to the object implementing VGSPDFViewDelegate protocol.

Code example

VGSImageView

A user interface element that displays revealed images to the user.

Declaration

VGSImageView Functional attributes

Attribute

Description

imageContentMode

UIView.ContentMode value, specifies how the image is rendered. Default to .scaleToFill

hasImage

read-only Boolean value, determines if an image is being revealed or it is empty

contentPath

read-only String instance, name associated with VGSImageView to decode image data from your organization vault

delegate

VGSImageViewDelegate object that will handle image reveal process

VGSImageView Functional functions

Function

Description

clear

Remove previously revealed image

VGSImageView configuration

Set contentPath for VGSImageView view as an identifier for Reveal operations on Inbound routes. Check more details on how to show revealed data here.

Handle changes in VGSImageView

You can handle changes in VGSImageView view setting its delegate property to the object implementing VGSImageViewDelegate protocol.

Code example

Reveal image with VGSShowSDK

Revealing image files might take more time than for text data. Consider your image file size and specify additional request timeout with VGSShowRequestOptions if needed. Max file size that can be sent to VGS is 24Mb.

Revealing invalid base64 data or invalid image data will produce an error.

Last updated