iOS SDK guide

Requirements and prerequisites

Requirements

  • Veriff iOS SDK requires at least iOS version 13.0

  • It is recommended that you use Veriff iOS SDK with the latest stable version of Xcode available at the time of the release.

→ See the iOS SDK migration guide for additional info

→ See the Backwards compatible changes and ensure your systems are able to handle these

Prerequisites

  • You have an active account with Veriff (see the Getting Started section)

  • You have an integration with Veriff (see the Getting Started section)

  • You have set up webhook(s) to get replies from Veriff (see the Webhooks section)


Add iOS SDK to the project

Option 1: Using Swift Package Manager

To integrate Veriff SDK with Swift Package Manager, open File > Swift Packages > Add Package Dependency and add the Veriff iOS SDK Swift Package repository URL as stated below:

https://github.com/Veriff/veriff-ios-spm/

Option 2: Using Cocoapods

To integrate Veriff SDK with Cocoapods, please add the line below to your Podfile and run pod install:

pod 'VeriffSDK'

After installation is done, use the newly created .xcworkspace file of your project.

→ See the Cocoapods guide [↗]

Option 3: Using Carthage

To integrate Veriff SDK into your Xcode project using Carthage, specify the required library below in your Cartfile:

binary "https://cdn.veriff.me/ios/carthage/VeriffSDK.json"

Run carthage update --use-xcframeworks and then drag and drop Veriff.xcframework from Carthage/Build folder to the Frameworks, Libraries, and Embedded Content section on your app target's General settings tab.

Option 4: Using XCFramework

To integrate Veriff SDK into your project manually, please download VeriffSDK [↓] (opening the link will start the download automatically).

After the download finishes, drag and drop the unzipped Veriff.xcframework to the Frameworks, Libraries, and Embedded Content section on your app target's General settings tab.


Add permissions

Usage descriptions

Veriff requires camera, microphone, photo library and optionally NFC reader permissions for capturing photos, video and scanning passports or ID cards during identification. Your application is responsible for describing the reason why camera, microphone, photo library and NFC reader are used. You need to add the three descriptions listed below to the Info.plist file of your application with the explanation of the usage.

  • NSCameraUsageDescription
  • NSMicrophoneUsageDescription
  • NSPhotoLibraryUsageDescription

Not adding these permissions will cause the system to shut down the application when it requests the permissions.


Enable NFC scanning

The NFC scanning logic is provided as a separate framework. If this feature is enabled in your integration, you can add the framework using one of the following methods:

Option 1: Using Swift Package Manager

To integrate VeriffNFC SDK with Swift Package Manager, open File > Swift Packages > Add Package Dependency and add the VeriffNFC Swift Package repository URL as stated below:

https://github.com/Veriff/veriff-nfc-ios-spm/

VeriffNFC package depends on the OpenSSL-Universal[↗] package. Please add it by following the steps described in the package’s SPM integration section[↗].

Option 2: Using Cocoapods

To integrate VeriffNFC SDK with Cocoapods, please add the line below to your Podfile and run pod install:

pod 'VeriffNFCSDK'

Option 3: Using Carthage

To integrate VeriffNFC SDK into your Xcode project using Carthage, specify the required library below in your Cartfile:

binary "https://cdn.veriff.me/ios/carthage/VeriffNFCSDK.json"

Run carthage update --use-xcframeworks and then drag and drop VeriffNFC.xcframework from Carthage/Build folder to the Frameworks, Libraries, and Embedded Content section on your app target's General settings tab.

VeriffNFC framework depends on the OpenSSL-Universal framework. Please add it by following the steps described in the package’s Carthage integration section.

Option 4: Using XCFramework

To integrate VeriffNFC SDK into your project manually, please download VeriffNFCSDK (opening the link will start the download automatically).

After the download finishes, drag and drop the unzipped VeriffNFC.xcframework to the Frameworks, Libraries, and Embedded Content section on your app target's General settings tab.

VeriffNFC framework depends on the OpenSSL-Universal framework. Please add it by downloading the OpenSSL.xcframework and repeating the same steps you have done for VeriffNFC.xcframework.

NFC scanning permissions

  1. Add NFCReaderUsageDescription description to Info.plist.
  2. In the Info.plist file, define the list of application IDs or AIDs it can connect to (the AID is a way of uniquely identifying an application on a ISO 7816 tag, which is usually defined by a standard)
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
	<string>D23300000045737445494420763335</string>
	<string>A0000002471001</string>
	<string>A0000002472001</string>
	<string>00000000000000</string>
</array>
  1. Introduce a new entitlement for NFC scanning, a feature made available from iOS 13 onwards. Xcode automatically adds this entitlement when you activate the Near Field Communication Tag Reading feature in the target Signing & Capabilities. Following the activation of this feature, the *.entitlements file should include the TAG format.
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
    <string>TAG</string>
</array>

Note: due to Apple's policies, you may be required to record and share a proof video of using the NFC. You can download and use the pre-recorded video linked below. If this does not solve the issue, please contact our support team.

Veriff_nfc_used_iOs (1)
5.99 MB


Start the verification flow

Step 1: Import Veriff framework

import Veriff
@import Veriff;

Step 2: Start the verification flow

Call the method below with the defined parameters.

// SwiftUI
let veriff = VeriffSdk.shared
veriff.startAuthentication(sessionUrl: sessionUrl)

// UIKit
let veriff = VeriffSdk.shared
veriff.startAuthentication(sessionUrl: sessionUrl, presentingFrom: yourViewController)
VeriffSdk *veriff = [VeriffSdk shared];
[veriff startAuthenticationWithSessionUrl:sessionUrl presentingFrom:yourViewController];
let veriff = VeriffSdk.shared
veriff.startAuthentication(sessionUrl: sessionUrl)

Parameters

Description

sessionUrl*

A combination of the base URL and the sessionToken, created as soon as a verification session is created. You can find its value in the response payload of your POST /sessions[↗] call, as verification.url. See Create a verification session article or more info.

configuration

Optional VeriffConfiguration object. See the Customize the SDK explanation below for instructions on how to use it.

presentingFrom

The ViewController of your app will present the Veriff SDK UI. Presentation always happens modally. This parameter should not be used in SwiftUI projects.

* Required parameter

A session is valid for 7 days and expires automatically after that.

What happens after the end-user leaves the flow?

When the end-user leaves the verification flow, i.e. a session is canceled or finished, the Veriff SDK is closed. The end-user is taken back to your application. The end-user flow completion status is returned to the host application, see Verification session status explanation below for more info.


Verification session status

To receive session results, you must conform to the VeriffSdkDelegate protocol and assign a delegate to the VeriffSdk instance.

veriff.delegate = self
veriff.delegate = self;

This is not the verification session decision.

This indicates whether the end-user was able to complete all the steps in the verification flow or not.

The Veriff iOS SDK returns a result code by calling sessionDidEndWithResult:

extension VerificationService: VeriffSdkDelegate {
    func sessionDidEndWithResult(_ result: Veriff.Result) {
        switch result.status {
        case .done:
            // The end-user successfully submitted the session
            break
        case .canceled:
            // The end-user canceled the verification process.
            break
        case .error(let error):
            switch error {
                // ...
            }
        }
    }
}
- (void)sessionDidEndWithResult:(VeriffResult *)result {
    switch (result.status) {
    case VeriffStatusDone:
        // The end-user successfully submitted the session, the session is completed from their perspective
        break;
    case VeriffStatusCanceled:
        // The end-user canceled the verification process
        break;
    case VeriffStatusError:
        // An error occurred during the flow
        if (result.error == nil) { break; }
        switch (result.error.code) {
            // ...
        }
    }
}

Inside the VeriffStatusError case you can do the following to check the error reason:

  • In Swift: check the associated value (Veriff.Error) passed by error status

  • In Objective-C: check result.error.code (VeriffErrorCode)

The Veriff SDK always shows an error screen itself. The errors returned by the VeriffSdkDelegate are meant for informing the host application.


Verification session decision

Veriff returns info about the verification session decision, extracted data, registries checks etc via webhooks. You need to set up webhooks and tie them to your system.

 See Webhooks Guide > Set up webhooks sub-section for detailed overview of the setup process


Customize the SDK

SDK customization is optional

It is possible to customize the look and feel of the UI to match your branding. You can change primitives such as colors and fonts, set the language settings for the SDK, and change if/how an intro screen is displayed.

Match the brand

If you decide to customize the SDK colors, set the branding property of VeriffSdk.Configuration before you start the verification.

Note: all custom values for branding are optional. If a value is not provided for them, the default Veriff color and logo will be used.

The Branding class allows customization of the navigation bar title image, button corner radius, font and following colors:

  • logo - navigation bar logo (see below for explanation)

  • background - screen and dialog background

  • onBackground - non-surface content (such as text, icons) displayed on the background color

  • onBackgroundSecondary - secondary non-surface content (such as text) displayed on the background color

  • onBackgroundTertiary - tertiary non-surface content (such as text) displayed on the background color

  • primary - primary surfaces (such as buttons) displayed on the background color

  • onPrimary - non-surface content (such as text) displayed on primary surfaces

  • secondary - secondary surfaces (such as bullet points and illustrations) displayed on the background color

  • onSecondary - non-surface content (such as text) displayed on secondary surfaces

  • cameraOverlay - overlay surface color on top of the camera preview screen

  • onCameraOverlay - non-surface content (such as text, icons) displayed on cameraOverlay

  • outline - outlines and boundaries of UI elements (such as text inputs)

  • error - error indicators (such as text, borders, icons) displayed on background color

  • success - success indicators (such as borders, icons) displayed on background color

→ See the Visual SDK customization guides article for design examples

let branding = VeriffSdk.Branding()
branding.logo = UIImage(named: "logo.png")
branding.background = UIColor.background
branding.onBackground = UIColor.onBackground
branding.onBackgroundSecondary = UIColor.onBackgroundSecondary
branding.onBackgroundTertiary = UIColor.onBackgroundTertiary
branding.primary = UIColor.primary
branding.onPrimary = UIColor.onPrimary
branding.secondary = UIColor.secondary
branding.onSecondary = UIColor.onSecondary
branding.cameraOverlay = UIColor.cameraOverlay
branding.onCameraOverlay = UIColor.onCameraOverlay
branding.outline = UIColor.outline
branding.error = UIColor.error
branding.success = UIColor.success
branding.buttonRadius = CGFloat.cornerRadius
branding.font = VeriffSdk.Branding.Font(regular: "Font", medium: "Font-Medium", bold: "Font-Bold")

VeriffBranding *branding = [[VeriffBranding alloc] init];
branding.logo = [UIImage imageNamed:@"logo.png"];
branding.background = [UIColor background];
branding.onBackground = [UIColor onBackground];
branding.onBackgroundSecondary = [UIColor onBackgroundSecondary];
branding.onBackgroundTertiary = [UIColor onBackgroundTertiary];
branding.primary = [UIColor primary];
branding.onPrimary = [UIColor onPrimary];
branding.secondary = [UIColor secondary];
branding.onSecondary = [UIColor onSecondary];
branding.cameraOverlay = [UIColor cameraOverlay];
branding.onCameraOverlay = [UIColor onCameraOverlay];
branding.outline = [UIColor outline];
branding.error = [UIColor error];
branding.success = [UIColor success];
branding.buttonRadius = 5;
branding.font = [[VeriffBrandingFont alloc] initWithRegular: @"Font" medium: @"Font-Medium" bold: @"Font-Bold"];

Custom logo image dimensions

For optimal results, we recommend that the height of your custom logo image be kept under 40 points, and the width under 90 points. If your logo exceeds these dimensions, it will be compressed while preserving its original aspect ratio.

Intro screen

It is possible to customise if the end-user flow begins with Veriff intro screen or no intro screen at all.

In some cases, it is possible to skip the Veriff’s generic introduction screen and use your own before Veriff’s SDK is launched.

Check with your Solutions Engineer to confirm if this feature can be enabled for your integration

If it is possible, the the following will happen:

  • You agree your own introduction screen visuals and copy with our Solutions Engineer and get relevant legal documents signed in case they are needed

  • After that Veriff will enable custom introduction screen from backend for your integrations

  • After you have implemented your own introduction screen you can change the configuration option specified below

configuration.customIntroScreen = true
configuration.customIntroScreen = YES;

Adding the configuration alone in your app is not enough to enable the custom intro screen. Make sure to contact your solutions engineer so they can enable the feature for your integration.

User interface locale settings

The Veriff iOS SDK allows setting the language of the SDK. In order to use this feature, please set the languageLocale property of VeriffSdk.Configuration before you start the verification.

let locale = Locale(identifier: "et")
NSLocale *locale = [NSLocale alloc] initWithLocaleIdentifier:@"et"];

Create the configuration object

let configuration = VeriffSdk.Configuration(branding: branding, languageLocale: locale)
VeriffConfiguration *configuration = [[VeriffConfiguration alloc] initWithBranding:branding languageLocale:locale];

→ See Supported languages in SDKs article for more info


Article versioning

Date

Description

Apr 23, 2025

Enable NFC scanning section added

Mar 12, 2025

Documentation published