iOS SDK
The Kora IDV iOS SDK provides a complete verification UI — document capture, selfie, and liveness detection — built with UIKit and SwiftUI support.
Requirements
- iOS 14.0+
- Xcode 14.0+
- Swift 5.7+
Installation
CocoaPods
# Podfile
pod 'KoraIDV', :git => 'https://github.com/badedokun/koraidv-koraidv-ios.git', :tag => 'v1.5.0'
pod install
Swift Package Manager
Add the package in Xcode:
- File → Add Package Dependencies
- Enter the repository URL:
https://github.com/badedokun/koraidv-koraidv-ios - Select version
1.5.0or later
Or add to your Package.swift:
dependencies: [
.package(url: "https://github.com/badedokun/koraidv-koraidv-ios.git", from: "1.5.0")
]
Quick start
1. Configure the SDK
import KoraIDV
// In your AppDelegate or app initialization
KoraIDV.configure(with: Configuration(
apiKey: "kora_sandbox_xxxxx",
tenantId: "your-tenant-uuid",
environment: .sandbox
))
2. Start a verification
The SDK creates the verification for you — pass your own externalId and a tier:
KoraIDV.startVerification(
externalId: "user-\(userId)",
tier: .standard,
presenting: self
) { result in
switch result {
case .success(let verification):
let status = verification.status
let riskScore = verification.riskScore ?? 0 // 0–100
let imagePersisted = verification.imagePersisted
// Handle success
case .failure(let error):
// Handle error
print(error.localizedDescription)
case .cancelled:
// User dismissed the flow
break
}
}
VerificationTier accepts: .basic, .standard, .enhanced. (See tier table.)
Verification tiers
| Tier | Includes |
|---|---|
.basic | Document OCR + basic authenticity |
.standard | + Face match + active liveness |
.enhanced | + Anti-spoof + risk signals + compliance screening (sanctions / PEP / adverse media) |
Resume an existing verification
If you have a verificationId from a webhook or previous attempt:
KoraIDV.resumeVerification(
verificationId: existingVerificationId,
presenting: self
) { result in
// Handle result
}
Configuration options
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey | String | Required | Your API key (kora_sandbox_… for sandbox, kora_live_… for production) |
tenantId | String | Required | Your tenant UUID |
environment | APIEnvironment | .sandbox | .sandbox or .production (auto-detected from API key prefix; explicit setting overrides) |
baseURL | URL? | nil | Override base URL (for on-premise deployments) |
theme | KoraTheme | Defaults | Custom theme colors and styling |
livenessMode | LivenessMode | .active | .active (challenges) or .passive (auto-detect) |
timeout | TimeInterval | 120 | Network request timeout in seconds |
debugLogging | Bool | false | Verbose logs |
Theme customization
let theme = KoraTheme(
primaryColor: UIColor.systemBlue,
backgroundColor: UIColor.systemBackground,
textColor: UIColor.label,
errorColor: UIColor.systemRed,
cornerRadius: 12,
buttonHeight: 48
)
KoraIDV.configure(
apiKey: "test_your_api_key",
tenantId: "your-tenant-uuid",
theme: theme
)
Error handling
case .failure(let error):
switch error.code {
case .networkError:
// Check internet connection
showRetryAlert(message: error.message)
case .cameraAccessDenied:
// Prompt user to enable camera in Settings
openSettings()
case .sessionExpired:
// Create a new verification on your server
createNewVerification()
case .userCancelled:
// User dismissed the verification
break
}
| Error Code | Description | Recovery |
|---|---|---|
.networkError | Network request failed | Check connection, retry |
.cameraAccessDenied | Camera permission not granted | Open Settings, request permission |
.sessionExpired | Verification session timed out | Create a new verification |
.userCancelled | User dismissed the UI | Prompt to try again |
Privacy permissions
Add to your Info.plist:
<key>NSCameraUsageDescription</key>
<string>Camera access is required to capture your identity document and selfie for verification.</string>
Troubleshooting
Environment naming conflict
If you have another Environment type in your project, use the fully qualified name:
KoraIDV.configure(
apiKey: "test_your_api_key",
tenantId: "your-tenant-uuid",
environment: KoraIDV.APIEnvironment.sandbox
)
Deployment target mismatch
Ensure your project's minimum deployment target is iOS 14.0 or higher. In Xcode: Project → General → Minimum Deployments.
CocoaPods cache issues
pod cache clean KoraIDV --all
pod deintegrate
pod install
Flutter bridge
If your iOS host is part of a Flutter app:
// In your AppDelegate
let controller = window?.rootViewController as! FlutterViewController
let channel = FlutterMethodChannel(
name: "com.yourapp/koraidv",
binaryMessenger: controller.binaryMessenger
)
channel.setMethodCallHandler { call, result in
if call.method == "startVerification" {
let args = call.arguments as! [String: Any]
let verificationId = args["verificationId"] as! String
KoraIDV.startVerification(
verificationId: verificationId,
presenting: controller
) { verificationResult in
switch verificationResult {
case .success(let v):
result(["status": v.status.rawValue, "riskScore": v.riskScore ?? NSNull()])
case .failure(let error):
result(FlutterError(
code: "VERIFICATION_ERROR",
message: error.message,
details: nil
))
}
}
}
}