Skip to content

Welcome to IDV Platform iOS documentation!

Introduction

This guide provides step-by-step instructions on integrating the IDV SDK into an iOS application. It covers installation, initialization, API configuration, workflow setup, and starting the ID verification process.

Prerequisites

Before integrating the SDK, ensure the following:

  • Minimum Deployment Target: iOS 14+
  • Camera permission enabled
  • NFC permission enabled
  • Internet permission enabled
  • Regula IDV SDK installed via CocoaPods or Swift Package Manager

The SDK includes multiple modules (Document Reader SDK, Face SDK). Include only the modules required for your Workflow and follow their specific setup instructions.

Add Regula SDK to Your Project

CocoaPods

  1. Add the base dependency into your Podfile:
target 'YourAppTarget' do
  use_frameworks!

  pod 'IDVSDK'
end
  1. Run installation:
pod install

Optional Modules installation guides

Swift Package Manager (SPM)

Swift Package Collection

You can add all Regula products in one place:

swift package-collection add https://pods.regulaforensics.com/SPM/PodsCollection-signed.json

Or in Xcode:

1. Navigate to File -> Add Package Dependencies 2. Click + and select Add Package Collection 3. Enter the collection URL:

https://pods.regulaforensics.com/SPM/PodsCollection-signed.json

4. Click Load -> Add Collection.

5. Select package(s), version, and project and click Add Package. For new projects, we recommend using the latest version.

Once you're finished, Xcode will begin downloading and resolving dependencies.

Add Packages Separately

You can add each package individually instead of using the collection.

1. In Xcode, navigate to File > Add Package Dependencies.

2. Enter the API package URL:

https://github.com/regulaforensics/IDVSDK-Swift-Package

3. Select package(s), version, and project and click Add Package. For new projects, we recommend using the latest version.

4. If needed, install additional modules:

Once you're finished, Xcode will begin downloading and resolving dependencies.

Initialize Regula IDV SDK

import IDVSDK

IDV.shared.initialize { result in
    switch result {
    case .success:
        print("IDV SDK initialized successfully")
    case .failure(let error):
        print("Initialization failed: \(error)")
    }
}

Configure API Settings

Before using the SDK, configure the API connection using one of the following methods:

Username and Password

let connectionConfig = CredentialsConnectionConfig(
    host: "your_host",
    username: "your_username",
    password: "your_password"
)

IDV.shared.configure(with: connectionConfig) { result in
    switch result {
    case .success:
        print("Configured successfully")
    case .failure(let error):
        print("Configuration failed: \(error)")
    }
}

Token-based

let tokenConfig = TokenConnectionConfig(url: URL(string: "your_token_url")!)

IDV.shared.configure(with: tokenConfig) { result in
    switch result {
    case .success(let workflowIds):
        print("Available workflows: \(workflowIds)")
    case .failure(let error):
        print("Configuration failed: \(error)")
    }
}

API Key

let apiKeyConfig = ApiKeyConnectionConfig(apiKey: "your_api_key")

IDV.shared.configure(with: apiKeyConfig) { result in
    switch result {
    case .success:
        print("Configured successfully with API key")
    case .failure(let error):
        print("Configuration failed: \(error)")
    }
}

Prepare and Start ID Verification Workflow

Retrieve Available Workflows

IDV.shared.getWorkflows { result in
    switch result {
    case .success(let workflows):
        print("Available workflows: \(workflows)")
    case .failure(let error):
        print("Failed to fetch workflows: \(error)")
    }
}

Prepare Workflow

let workflowConfig = PrepareWorkflowConfig(workflowId: "your_workflow_id")

IDV.shared.prepareWorkflow(by: workflowConfig) { result in
    switch result {
    case .success(let workflow):
        print("Workflow prepared: \(workflow.id)")
    case .failure(let error):
        print("Failed to prepare workflow: \(error)")
    }
}

Start Workflow

IDV.shared.startWorkflow(presenter: presenterViewController) { result in
    switch result {
    case .success(let workflowResult):
        print("Verification finished. Session ID: \(workflowResult.sessionId)")
    case .failure(let error):
        print("Verification failed: \(error)")
    }
}

Optionally, you can pass a StartWorkflowConfig with metadata:

var config = StartWorkflowConfig.default()
config.metadata = ["key": "value"]

IDV.shared.startWorkflow(presenter: self, config: config) { result in
    switch result {
    case .success(let workflowResult):
        print("Workflow completed successfully")
    case .failure(let error):
        print("Workflow failed: \(error)")
    }
}

To start the Workflow with a specific locale:

var config = StartWorkflowConfig.default()
config.locale = "en"
IDV.shared.startWorkflow(presenter: self, config: config) { result in
    switch result {
    case .success(let workflowResult):
        print("Workflow completed successfully")
    case .failure(let error):
        print("Workflow failed: \(error)")
    }
}

Deinitialize SDK

When the SDK is no longer needed (for example, logout):

IDV.shared.deinitialize { result in
    switch result {
    case .success:
        print("SDK deinitialized")
    case .failure(let error):
        print("Failed to deinitialize: \(error)")
    }
}

Best Practices & Troubleshooting

  • Initialize the SDK first before configuring or preparing Workflows
  • Handle error callbacks (Result.failure) properly
  • Ensure camera permissions are granted before starting Workflows
  • For production apps, implement secure storage for tokens and credentials