iOS SDK

Prerequisites

Before integrating the SDK, ensure your development environment meets the following requirements:

  • Xcode version: 16.4
  • iOS Minimum Version: 16.6
  • Swift Tools version: 6.0

Adding the SDK to Your Project

You can add the iOS SDK to your project using Swift Package Manager.

1

In Xcode, navigate to File > Add Packages…

3

Select the desired version (the latest version is v0.8.0)

Required App Integration Steps

1

Our Mobile SDK requires camera, microphone, photo library and NFC reader permissions for capturing photos, videos and scanning legal documents during identification. Your application is responsible for declaring the reason why these permissions are used. You need to add the descriptions listed below to Info.plist of your application with the explanation of usage:

  • NSCameraUsageDescription
  • NSMicrophoneUsageDescription
  • NSPhotoLibraryUsageDescription
  • NFCReaderUsageDescription
2

You will also need to add the list of application IDs or AIDs it can connect to in your application’s Info.plist file. AIDs uniquely identify an application on an ISO 7816 tag.

1<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
2<array>
3 <string>D23300000045737445494420763335</string>
4 <string>A0000002471001</string>
5 <string>A0000002472001</string>
6 <string>00000000000000</string>
7</array>
3

You will need to introduce a new entitlement for NFC scanning. Xcode automatically adds this entitlement when you activate the Near Field Communication Tag Reading feature under Signing & Capabilities. Once this feature is enabled, the entitlements file should include the TAG format, as shown below.

1<key>com.apple.developer.nfc.readersession.formats</key>
2<array>
3 <string>TAG</string>
4</array>
4

You may be required to record and share a video with Apple demonstrating the usage of NFC scanning within your application.

Initialization

To initialize the SDK, create a subclass of the App class, and add the following code to your init() method:

1struct SampleAppApp: App {
2 init() {
3 IDmeSDK.shared.initialize(sdkConfig: sdkConfig)
4 }
5}

You will need to pass in an instance of IDmeSDKConfig while initializing the SDK. This example demonstrates how to create this config:

1private var sdkConfig: IDmeSDKConfig {
2 return IDmeSDKConfig(
3 externalUserId: "sample-user-id", // Unique identifier for the user
4 appName: "SampleApp", // Name of the app
5 tokenProvider: Self.tokenProvider
6 )
7}

The tokenProvider in the example is responsible for generating the client access token. This token enables the SDK to make REST API requests to ID.me’s backend APIs. The application must obtain a client access token from ID.me and provide a function to generate a new token if the current one expires. The SDK will then automatically use this to make REST API requests. This example illustrates the signature of this token provider method:

1static func tokenProvider() async throws -> String {
2 // Fetch client token from the backend and return it
3}

Common Usage Patterns

This section provides examples of common tasks you can perform with our Mobile SDK.

This section details the process of legal document verification utilizing our Mobile SDK. Initiating a verification is straightforward, as demonstrated by the code snippets below.

If your application uses SwiftUI
1let manager = IDmeSDK.shared.getVerificationsManager()
2let workflowView = manager.createVerificationWorkflowView(
3 verificationType: .document
4) { result in
5 print("Verification result: \(result.verificationStatus)")
6}
7// Present workflowView in your SwiftUI hierarchy
If your application uses UIKit
1let manager = IDmeSDK.shared.getVerificationsManager()
2manager.launchVerificationWorkflow(
3 from: self,
4 verificationType: .document
5) { result in
6 switch result.verificationStatus {
7 case .completed:
8 print("Success! Credential: \(result.credentialUuid ?? "")")
9 case .failed:
10 print("Failed: \(resulr.errorMessage ?? "")")
11 case .cancelled:
12 print("User cancelled")
13 default:
14 break
15}

Checking the Status of an Ongoing Verification

This section describes how to obtain the status of an ongoing verification.

// Returns the verificationID of the current verification and its status
IDmeSDK.shared.getVerificationsManager().getCurrentVerification()

Customizing the Document Scanner User Interface

This section details how to customize the document scanner’s user interface. While default values are based on ID.me’s design system, you have the flexibility to replace any or all of these to align with your application’s aesthetic. We provide customization options for the following elements:

  • Colors: Modify the color scheme of various interface elements.
  • Button Radius: Control the roundness of buttons within the Mobile SDK.
  • Logo: Replace the default ID.me logo with your application’s logo.
  • Fonts: Choose the fonts used for all text displayed in the document scanner interface.
The following optional fields are available for customization
1let customUIConfig = DocScanUIConfig(
2 colors: DocScanColors(
3 background: UIColor.<insert color>,
4 onBackground: UIColor.<insert color>,
5 onBackgroundSecondary: UIColor.<insert color>,
6 onBackgroundTertiary: UIColor.<insert color>,
7 primary: UIColor.<insert color>,
8 onPrimary: UIColor.<insert color>,
9 secondary: UIColor.<insert color>,
10 onSecondary: UIColor.<insert color>,
11 cameraOverlay: UIColor.<insert color>,
12 onCameraOverlay: UIColor.<insert color>,
13 outline: UIColor.<insert color>,
14 success: UIColor.<insert color>,
15 error: UIColor.<insert color>
16 ),
17 buttonRadius: <insert button radius>,
18 logo: <insert logo>,
19 fonts: DocScanFonts(
20 regular: <insert font>,
21 medium: <insert font>,
22 bold: <insert font>
23 )
24)
25
26// Sets the custom UI config on the document scanner
27IdmeSDK.shared.getVerificationsManager().setDocScanUIConfig(customUIConfig)

Support

If you encounter any issues or have questions, please contact our developer support team. You can reach us at mobile-sdk-issues@id.me.