Getting Started

Getting Started with VGS Collect iOS SDK

Before you start, you can check the VGSCollectSDK GitHub Pagearrow-up-right, download the Demo Applicationarrow-up-right, or browse the SDK Referencearrow-up-right.

How to Integrate the SDK

Quickstart from Dashboard

Ensure your organization is registered at VGS Dashboardarrow-up-right. A Sandbox Vault will be pre-created for you. Use your VGS Dashboardarrow-up-right to start collecting data. If you haven't registered an organization yet, check the Quick Integration guides. Then, follow the VGSCollectSDK integration guide below.

Integrate VGSCollectSDK into Your iOS Project

Step 1: Install the SDK

VGSCollectSDK is distributed through Swift Package Managerarrow-up-right and CocoaPodsarrow-up-right. Additionally, an XCFramework (distributed as VGSCollectSDK.xcframework.zip) is available via GitHub releasesarrow-up-right.

Integrate with Swift Package Manager

To use Swift Package Manager, add the dependency https://github.com/verygoodsecurity/vgs-collect-ios.git in Xcode and choose the exact version. Then, select VGSCollectSDK and, optionally, other packages provided with VGSCollectSDK. Follow the official Apple SPM guide instructionsarrow-up-right for more details.

AI Agent Integration & Assisted Development

To accelerate your integration and ensure your implementation follows VGS best practices, you can use the AGENTS.mdarrow-up-right file as a context for AI Coding Agents. Attach or reference the URL to the AGENTS.md file to your agent's context: https://github.com/verygoodsecurity/vgs-collect-ios/blob/master/AGENTS.mdarrow-up-right.

Example System Prompt: "You are an autonomous engineering agent integrating the VGS Collect iOS SDK into an existing Swift app. Use the contents of AGENTS.md as your authoritative policy. Goals:

  1. Add a secure card form (Number, Name, Expiration, CVC).

  2. Validate all fields before submission.

  3. Provide unit tests for valid/invalid card inputs.”

Integrate with CocoaPods

Install the latest version of CocoaPodsarrow-up-right. Open Terminal and run the command:

If you don't have an existing Podfile in your project, navigate to your project folder and run the following command to create one:

Then, open the file in Xcode for editing:

Add the VGSCollectSDK pod to your Podfile inside your project folder:

Return to your Terminal window and run the following command to install VGSCollectSDK:

From now on, open your project in Xcode using the <your-app>.xcworkspace file instead of the .xcodeproj file.

Update Pods (Optional)

If you previously installed VGSCollectSDK, you might need to update the SDK to the latest version. To do so, run the following command in Terminal:

Integrate with XCFramework

XCFramework integration is a separate integration method. An XCFramework is attached to each GitHub releasearrow-up-right as VGSCollectSDK.xcframework.zip. Only the Core SDK module is supported in the XCFramework distribution. To validate the XCFramework checksum, run in Terminal shasum -a 256 VGSCollectSDK.xcframework.zip and compare it with the value provided in the VGSCollectSDK-checksum.txtarrow-up-right file in the repository.

Next

Follow the integration guide to see an example of how to create a simple form for collecting credit card data and sending it to your Vault.

Step 2: Configure Your App

Import the VGSCollectSDK framework and initialize a VGSCollect instance in your app. When initializing VGSCollect, set your Vault id and Environment type:

  • You can have multiple VGSCollect instances; each will work independently with its own configured fields. - All VGSCollect instances can be configured differently.\

The integration process consists of two steps: configuring VGS Collect UI components and sending data to VGS.

Configure UI Components

Create UI Form

Add VGS Collect UI components to your view and set up the layout. More information about VGS Collect UI components is described here.

Setup VGS Collect Fields

Each VGSTextField should be configured with VGSConfiguration. For more details on field configuration, see here.

Observe VGSTextField States

You can observe the state of VGSTextField during user interactions. Read more about observing states here.

Securely Collecting and Sending Information

Use vgsCollect.sendData(_:) to collect data from VGS Collect UI components and securely send it to your Vault. More details on sending data to your Vault can be found here.

Next Steps

Last updated