SmartComply iOS SDK
The SmartComply iOS SDK is a native Swift library that delivers a fully self-contained identity verification flow for iOS apps. Drop in one SwiftUI view and the SDK handles session management, country and ID-type selection, document capture, identity verification, and liveness detection automatically.Features
- Drop-in SwiftUI view —
SmartComplyFlowViewmanages the entire verification flow with no UI code required - Two verification modes — document photo capture or ID number data entry, configured from your Dashboard
- Guide-box document capture — crops exactly what falls inside the ID card frame so the image sent to the backend is always clean
- Liveness detection — face challenge system (blink, turn head) runs automatically after identity verification
- Dynamic ID types — channels and fields are fetched live from your Dashboard configuration
- Multi-country support — renders a country picker automatically when more than one country is configured
- Dark and light mode — theme adapts to the system colour scheme; override with
preferredColorScheme - Automatic retry — handles upload retries and session errors internally
Requirements
- iOS 16.0 or later
- Swift 5.9 or later
- Xcode 15 or later
- iPhone X or later — liveness detection requires a front-facing TrueDepth camera
Installation
The SDK is distributed via Swift Package Manager.Xcode (recommended)
- Open your project in Xcode
- Go to File → Add Package Dependencies
- Enter the repository URL:
https://github.com/386konsult/ios-sdk - Select Exact Version and enter
1.0.0 - Click Add Package and select the SmartComplySDK library
Package.swift
Platform Setup
Add the following key to your app’sInfo.plist:
Quick Start
1. Create the SDK instance
Create aSmartComply instance once — for example in your view model or app entry point. Generate a fresh clientId (UUID) for each new verification attempt.
2. Present the flow view
EmbedSmartComplyFlowView anywhere in your SwiftUI hierarchy. The SDK loads automatically when the view appears.
- Creates a secure session
- Displays a welcome screen with your brand name and ID type cards
- Shows a country picker if multiple countries are configured
- User photographs the front of their ID inside the guide box
- Photographs the back if required (National ID, Driver’s Licence, Voter’s Card)
- Runs liveness face challenges
- Returns a
FlowResultto your completion handler
- Creates a secure session
- Displays a welcome screen with ID type selection
- Shows a country picker if multiple countries are configured
- User enters their ID number and any required fields
- Identity is verified against the national database
- Runs liveness face challenges
- Returns a
FlowResultto your completion handler
SDK Configuration
| Parameter | Default | Description |
|---|---|---|
apiKey | — | Your SmartComply API key (required) |
clientId | — | A unique identifier per verification attempt — use UUID().uuidString (required) |
environment | .sandbox | .sandbox for testing; .production for live traffic |
requestTimeout | 30 | Timeout in seconds for standard API calls |
uploadTimeout | 120 | Timeout in seconds for video upload |
maxUploadRetries | 3 | Number of automatic retry attempts on upload failure |
debug | false | Prints verbose network logs to the console when true |
FlowResult
Delivered to youronComplete closure when the user completes the flow in-app.
Final verification results are delivered via webhook. Once the backend completes processing, SmartComply sends a webhook event to the URL configured in your Dashboard. Set up your webhook endpoint to receive the final status, extracted fields, and any failure reasons. See the Webhooks guide for the full payload reference.
Error Handling
SmartComplyFlowView handles and displays error states automatically. For the headless API, all SDK methods throw on failure:
| Scenario | Cause | Resolution |
|---|---|---|
401 Unauthorized | Invalid or missing API key | Check your key in the SmartComply Dashboard |
| Session expired | Sessions expire after 2 hours and are single-use | Generate a new clientId and call createSession() again |
| Camera permission denied | User denied camera access | The flow view shows a Settings deep-link automatically |
| Upload failed after retries | Network instability | maxUploadRetries exhausted — the failure screen offers a retry |
| Identity not found | ID number not found or details mismatched (data mode) | User is shown the reason and prompted to re-enter |

