> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.id.me/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.id.me/_mcp/server.

# iOS SDK

> Learn how to integrate and use ID.me's native SDK for iOS

> **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.

In Xcode, navigate to **File** > **Add Packages...**

Enter the repository URL: [https://github.com/idme/idme-mobilesdk-artifacts](https://github.com/idme/idme-mobilesdk-artifacts)

Select the desired version (the latest version is `v0.9.0`)

# Required app integration steps

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`

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.

```xml
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
	<string>D23300000045737445494420763335</string>
	<string>A0000002471001</string>
	<string>A0000002472001</string>
	<string>00000000000000</string>
</array>
```

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.

```xml
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
	<string>TAG</string>
</array>
```

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:

```swift
struct SampleAppApp: App {
	init() {
		IDmeSDK.shared.initialize(sdkConfig: sdkConfig)
	}
}
```

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

```swift
private var sdkConfig: IDmeSDKConfig {
	return IDmeSDKConfig(
		externalUserId: "sample-user-id", // Unique identifier for the user
		appName: "SampleApp", // Name of the app
		tokenProvider: Self.tokenProvider
	)
}
```

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:

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

# Common usage patterns

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

## Performing legal document and face liveness verification

This section details the process of legal document and face liveness verification utilizing our Mobile SDK.

Initiating a verification is straightforward, as demonstrated by the code snippets below.

```swift
let manager = IDmeSDK.shared.getVerificationsManager()

// Kick off document verification flow
let workflowView = manager.createVerificationWorkflowView(
	verificationType: .document
) { result in
	print("Verification result: \(result.verificationStatus)")
}
// Present workflowView in your SwiftUI hierarchy

// Kick off face liveness verification flow
let workflowView = manager.createVerificationWorkflowView(
	verificationType: .faceLiveness
) { result in
	print("Verification result: \(result.verificationStatus)")
}
// Present workflowView in your SwiftUI hierarchy
```

```swift
let manager = IDmeSDK.shared.getVerificationsManager()

// Document verification flow
manager.launchVerificationWorkflow(
	from: self,
	verificationType: .document
) { result in
	switch result.verificationStatus {
	case .completed:
		print("Success! Credential: \(result.credentialUuid ?? "")")
	case .failed:
		print("Failed: \(result.errorMessage ?? "")")
	case .cancelled:
		print("User cancelled")
	default:
		break
}

// Face liveness verification flow
manager.launchVerificationWorkflow(
	from: self,
	verificationType: .faceLiveness
) { result in
	switch result.verificationStatus {
	case .completed:
		print("Success!")
	case .failed:
		print("Failed: \(result.errorMessage ?? "")")
	case .cancelled:
		print("User cancelled")
	default:
		break
}
```

## 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 user interface

This section details how to customize the 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.

```swift
let customBaseUIConfig = IDmeBaseUIConfig(
	colors: IDmeBaseColors(
		background: UIColor.<insert color>,
		onBackground: UIColor.<insert color>,
		onBackgroundSecondary: UIColor.<insert color>,
		onBackgroundTertiary: UIColor.<insert color>,
		primary: UIColor.<insert color>,
		onPrimary: UIColor.<insert color>,
		secondary: UIColor.<insert color>,
		onSecondary: UIColor.<insert color>,
		outline: UIColor.<insert color>,
		success: UIColor.<insert color>,
		error: UIColor.<insert color>
	),
	buttonRadius: <insert button radius>,
	logo: <insert logo>,
	fonts: IDmeFonts(
		regular: <insert font>,
		medium: <insert font>,
		bold: <insert font>,
		semibold: <insert font>
	),
	fontSizes: IDmeFontSizes(
		textXs: <insert font size>,
		textSm: <insert font size>,
		textMd: <insert font size>,
		display2Xs: <insert font size>
	)
)

// Sets the custom UI config
IdmeSDK.shared.getVerificationsManager().setBaseUIConfig(customBaseUIConfig)

IdmeSDK.shared.getVerificationsManager().setDocScanUIConfig(customDocScanUIConfig)

IdmeSDK.shared.getVerificationsManager().setFaceLivenessUIConfig(customFaceLivenessUIConfig)
```

# Support

> **Note**
>
> If you encounter any issues or have questions, please contact our developer support team. You can reach us at [mobile-sdk-issues@id.me](mailto:mobile-sdk-issues@id.me).