iOS Integration Guide

Integrate the Persona Inquiry flow directly into your iOS app with our native SDK.

Installation

To integrate the Persona Inquiry SDK in your iOS app you can use either CocoaPods or Carthage.

Please note: iOS 11.0 or later is required.

Install via Cocoapods

To install the SDK with CocoaPods, add PersonaInquirySDK as on of your target dependencies in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

target 'Your Project' do
    pod 'PersonaInquirySDK'
end

Please be sure to run pod update and use pod install --repo-update to ensure you have the most recent version of the SDK installed.

Install via Carthage

To install the SDK with Carthage, add persona-id/inquiry-ios to your Cartfile:

github "persona-id/inquiry-ios"

Update your Info.plist

In addition to importing the dependency, you also need to modify your Info.plist:

  1. Navigate to your project’s settings in Xcode and click the Info tab
  2. Add a new Privacy - Camera Usage Description entry (if not already present) to enable camera access.

Usage

The Persona Inquiry verification flow is initiated with an InquiryConfiguration. This configuration can be initialized with either a templateId or an inquiryId.

Please refer to the code sample below and replace my_template_id with your template ID. You can find your template ID on the Persona Dashboard under “Development”.

This starts the Inquiry flow and takes control of the user interface. Once the flow completes the control of the user interface is returned to the app and the appropriate delegate method will be called.

class ViewController: UIViewController, InquiryDelegate {

    // This is hooked up to a button which starts the flow
    @IBAction func buttonTapped(_ sender: UIButton) {
        let config = InquiryConfiguration(templateId: "my_template_id")

        // Create the inquiry with the view controller 
        // as the delegate and presenter.
        Inquiry(config: config, delegate: self).start(from: self)
    }

    // MARK: - Inquiry Delegate Methods

    func inquirySuccess(inquiryId: String, attributes: Attributes?) {
        // ✅ Inquiry succeeded
    }

    func inquiryCancelled() {
        // ⏏️ Inquiry cancelled by user
    }

    func inquiryFailed(inquiryId: String) {
        // ❌ Inquiry failed
    }

    func inquiryError(_ error: Error) {
        // ⚠️ Inquiry errored
    }
}

Inquiry Results

The results of the inquiry are passed back to the InquiryDelegate, and are as follows

  • inquirySuccess(inquiryId: String, attributes: Attributes?) — the inquiry passed
  • inquiryFailed(inquiryID: String) — the inquiry failed
  • inquiryCancelled() — the inquiry was cancelled by the user
  • inquiryError(_ error: Error) — the inquiry errored

Configuration Options

Some different configuration examples can be found below:

// Configuration with only a template ID
let config = InquiryConfiguration(
    templateId: "tmpl_JAZjHuAT738Q63BdgCuEJQre"
)

// Configuration with only a template ID in the sandbox
let config = InquiryConfiguration(
    templateId: "tmpl_JAZjHuAT738Q63BdgCuEJQre", 
    environment: .sandbox
)

// Configuration with a template and reference ID
let config = InquiryConfiguration(
    templateId: "tmpl_JAZjHuAT738Q63BdgCuEJQre", 
    referenceId: "myReference"
)

// Configuration with a template and account ID
let config = InquiryConfiguration(
    templateId: "tmpl_JAZjHuAT738Q63BdgCuEJQre", 
    accountId: "act_W6thEnEU19gphPqq5uTzZ4Y8"
)

// Configuration with only an inquiry ID
let config = InquiryConfiguration(
    inquiryId: "inq_JAZjHuAT738Q63BdgCuEJQre", 
)

// Configuration with only a template ID and a theme
var theme = InquiryTheme()
theme.backgroundColor = .purple
theme.bodyTextColor = .white

let config = InquiryConfiguration(
    templateId: "tmpl_JAZjHuAT738Q63BdgCuEJQre", 
    theme: theme
)