Skip to main content

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', '~> 1.1.0'
pod install

Swift Package Manager

Add the package in Xcode:

  1. File → Add Package Dependencies
  2. Enter the repository URL: https://github.com/korastratum/koraidv-ios
  3. Select version 1.1.0 or later

Or add to your Package.swift:

dependencies: [
.package(url: "https://github.com/korastratum/koraidv-ios", from: "1.1.0")
]

Quick start

1. Configure the SDK

import KoraIDV

// In your AppDelegate or app initialization
KoraIDV.configure(
apiKey: "test_your_api_key",
tenantId: "your-tenant-uuid",
environment: .sandbox
)

2. Start a verification

// Create verification on your server first, then launch with the ID
KoraIDV.startVerification(
verificationId: "ver_abc123", // From your server
presenting: self,
documentTypes: [.usPassport, .usDriversLicense],
livenessMode: .active
) { result in
switch result {
case .success(let verification):
let status = verification.status
let score = verification.overallScore
let imagePersisted = verification.imagePersisted
// Handle success

case .failure(let error):
// Handle error
print(error.message)
}
}

Resume an existing verification

KoraIDV.resumeVerification(
verificationId: existingVerificationId,
presenting: self
) { result in
// Handle result
}

Configuration options

ParameterTypeDefaultDescription
apiKeyStringRequiredYour API key (test_ for sandbox, live_ for production)
tenantIdStringRequiredYour tenant UUID
environmentAPIEnvironment.sandbox.sandbox or .production
baseURLString?nilOverride base URL (for on-premise deployments)
documentTypes[DocumentType]All typesRestrict which document types are accepted
livenessModeLivenessMode.active.active (challenges) or .passive (auto-detect)
themeKoraTheme?nilCustom theme colors and styling
timeoutTimeInterval300Session timeout in seconds

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 CodeDescriptionRecovery
.networkErrorNetwork request failedCheck connection, retry
.cameraAccessDeniedCamera permission not grantedOpen Settings, request permission
.sessionExpiredVerification session timed outCreate a new verification
.userCancelledUser dismissed the UIPrompt 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, "score": v.overallScore])
case .failure(let error):
result(FlutterError(
code: "VERIFICATION_ERROR",
message: error.message,
details: nil
))
}
}
}
}