> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS पहचान सत्यापन SDK: मोबाइल KYC

> Didit का नेटिव iOS Swift SDK: पहचान सत्यापन, बायोमेट्रिक लाइवनेस और NFC ई-पासपोर्ट रीडिंग। प्रति उपयोग भुगतान, $10 निःशुल्क/माह, कोई अनुबंध नहीं।



iOS SDK इंटीग्रेशन प्रॉम्प्ट
        प्रॉम्प्ट को क्लिपबोर्ड पर कॉपी करें



      
      

\<pre>

\`Integrate Didit identity verification into my iOS app using the native Swift SDK (DiditSDK 4.13.2).

\## Requirements
\- iOS 13.0+, Xcode 15.0+, Swift 5.9+
\- NFC chip reading requires iOS 15+ and a compatible device with NFC hardware
\- Since 4.0.0 the SDK ships in four variants; pick exactly one:
\- Core (DiditSDKCore): no NFC, no auto-detection, no OpenSSL, iOS 13.0+, smallest binary (manual capture only)
\- AutoDetection (DiditSDKAutoDetection): ML auto-capture, no NFC, no OpenSSL, iOS 13.0+
\- NFC (DiditSDKNFC): NFC passport reading, bundles OpenSSL 3.3.3, iOS 15.0+
\- All (DiditSDK — default): every feature, bundles OpenSSL 3.3.3, iOS 15.0+

\## Installation

\### Option A: Swift Package Manager (recommended)
1\. In Xcode: File > Add Package Dependencies
2\. Enter URL: https://github.com/didit-protocol/sdk-ios.git
3\. Select version 4.13.2 (or "Up to Next Major") and click Add Package
4\. Add exactly one library product for your variant:
\- All (NFC + auto-detection): product "DiditSDK"
\- Core (no NFC, no auto-detection): product "DiditSDKCore"
\- AutoDetection (auto-capture, no NFC): product "DiditSDKAutoDetection"
\- NFC (NFC, no auto-detection): product "DiditSDKNFC"

In Package.swift:
.package(url: "https://github.com/didit-protocol/sdk-ios.git", from: "4.13.2")
Then add one product, e.g. .product(name: "DiditSDK", package: "DiditSDK") or .product(name: "DiditSDKCore", package: "DiditSDK"). Your code always writes import DiditSDK regardless of variant.

\### Option B: CocoaPods (binary podspec — DiditSDK is not on the public Trunk)
podspec_url = 'https://raw.githubusercontent.com/didit-protocol/sdk-ios/4.13.2/DiditSDK.podspec'
\# Pick exactly one subspec:
\# All (NFC + auto-detection, iOS 15+):
platform :ios, '15.0'
pod 'DiditSDK/All', :podspec => podspec_url
\# Core (no NFC, no auto-detection, iOS 13+):        pod 'DiditSDK/Core', :podspec => podspec_url
\# AutoDetection (auto-capture, no NFC, iOS 13+):    pod 'DiditSDK/AutoDetection', :podspec => podspec_url
\# NFC (NFC, no auto-detection, iOS 15+):            pod 'DiditSDK/NFC', :podspec => podspec_url

Then run: pod install
Open the .xcworkspace (not .xcodeproj).

On Xcode 15+ if you hit rsync "Operation not permitted", set Build Setting ENABLE_USER_SCRIPT_SANDBOXING to No on the project (Debug and Release).

\## Required Permissions (Info.plist)
\- NSCameraUsageDescription (required) — Document scanning and face verification
\- NSMicrophoneUsageDescription (required) — Video recording for liveness checks
\- NSPhotoLibraryUsageDescription (required) — Upload documents from gallery
\- NFCReaderUsageDescription (only if using the NFC or All variant) — Read NFC chips in passports/IDs
\- NSLocationWhenInUseUsageDescription (optional) — Geolocation for fraud prevention

\## NFC Configuration (NFC or All variant only — skip for the Core or AutoDetection variants)
1\. Add "Near Field Communication Tag Reading" capability in Xcode > Signing & Capabilities
2\. Add ISO7816 identifiers to Info.plist:
com.apple.developer.nfc.readersession.iso7816.select-identifiers:
\["D23300000045737445494420763335", "A0000002471001", "A0000002472001", "00000000000000", "D392F000260100000001"]
(D392F000260100000001 is the Japan My Number Card's JPKI application: without it, iOS does not report that card to the SDK.)
3\. Add to entitlements file:
com.apple.developer.nfc.readersession.formats: ["TAG"]

\## Backend: Create Session (your server)
POST https://verification.didit.me/v3/session/
Headers: { "x-api-key": DIDIT_API_KEY, "Content-Type": "application/json" }
Body: { "workflow_id": DIDIT_WORKFLOW_ID, "vendor_data": "user-id" }
Response: { "session_id": "uuid", "session_token": "short-token", "url": "https://verify.didit.me/session/short-token", "status": "Not Started" }
Send session_token to the iOS app (never expose DIDIT_API_KEY to the device).

\## SwiftUI Integration (recommended)
import SwiftUI
import DiditSDK

struct ContentView: View {
var body: some View {
    Button("Verify Identity") {
        // Option A: With session token from your backend (recommended)
        DiditSdk.shared.startVerification(token: "session-token-from-backend")

        // Option B: With workflow ID (SDK creates session internally — UniLink, vendorData only)
        // DiditSdk.shared.startVerification(workflowId: "your-workflow-id", vendorData: "user-id")
    }
    .diditVerification { result in
        switch result {
        case .completed(let session):
            // session.status: VerificationStatus = .approved | .pending | .declined
            if session.status == .approved { /* grant access */ }
        case .cancelled(let session):
            // User dismissed the flow; session may be nil if none was created
            \_ = session
        case .failed(let error, _):
            // VerificationError — show error.localizedDescription
            \_ = error
        }
    }
}
}

\## Programmatically dismissing the verification (3.6.0+)
Call DiditSdk.shared.dismiss() to end an active verification (e.g. on app backgrounding).
It dismisses the UI, resets state, and fires the .diditVerification handler with .cancelled(session:).
Do NOT toggle DiditSdk.shared.isPresented = false or call UIKit dismiss() on the topmost VC — that bypasses the completion pipeline.

\## Result Statuses (SDK enum / API string)
\- .approved / "Approved"  — user identity verified, grant access
\- .declined / "Declined"  — verification failed, show retry or contact support
\- .pending  / "In Review" — needs manual review by your compliance team

\## Full Verification Results
The SDK only returns the status. Full decision data (document fields, face match scores, AML hits, etc.) arrives via webhook to your backend.
Set up webhooks: https://docs.didit.me/integration/webhooks

\## Rate Limits (session creation)
\- 600 session-create requests / minute per x-api-key (see https://docs.didit.me/integration/rate-limiting)
\- On 429, retry honouring Retry-After / X-RateLimit-* headers

\## Environment Variables (backend only — never expose in the iOS app)
\- DIDIT_API_KEY — from Didit Console > API & Webhooks
\- DIDIT_WORKFLOW_ID — from Didit Console > Workflows

\## App Store Note
If you ship the NFC or All variant, Apple may request an NFC demo video during review. Request ours from [support@didit.me](mailto:support@didit.me).

\## Docs
\- iOS SDK: https://docs.didit.me/integration/native-sdks/ios-sdk
\- GitHub: https://github.com/didit-protocol/sdk-ios
\- Webhooks: https://docs.didit.me/integration/webhooks
\- API Reference: https://docs.didit.me/api-reference/overview`

\</pre>



      
      

यहाँ पेस्ट करें

एक हल्का, सर्वर-संचालित iOS SDK, जिसे न्यूनतम कॉन्फ़िगरेशन की आवश्यकता होती है। **नवीनतम संस्करण: 4.13.2.**> [card] [GitHub रिपॉज़िटरी](https://github.com/didit-protocol/sdk-ios)
>
> GitHub पर सोर्स कोड, रिलीज़ और पूरा चेंजलॉग देखें> [!NOTE]
>
> ### **नेटिव SDK**: iOS ऐप्स के लिए यही अनुशंसित तरीका है। नेटिव SDK बेहतर उपयोगकर्ता अनुभव, अनुकूलित कैमरा हैंडलिंग और पूर्ण NFC समर्थन प्रदान करते हैं।***## आवश्यकताएँ| आवश्यकता | न्यूनतम संस्करण |
| - | - |
| iOS | 13.0+ |
| Xcode | 15.0+ |
| Swift | 5.9+ |### iOS संस्करण संगतता| iOS संस्करण | उपलब्ध सुविधाएँ |
| - | - |
| iOS 13.0 - 14.x | NFC पासपोर्ट रीडिंग **को छोड़कर** सभी सुविधाएँ |
| iOS 15.0+ | NFC पासपोर्ट रीडिंग सहित सभी सुविधाएँ |> [!NOTE]
>
> **बायोमेट्रिक सहमति के लिए नेटिव 4.10.0 या उसके बाद का संस्करण चाहिए।** यदि लोग Illinois, Texas या Colorado के कानून के अंतर्गत आते हैं, तो Didit पहले चेहरे के कैप्चर से पहले स्पष्ट [बायोमेट्रिक सहमति](https://docs.didit.me/hi/getting-started/biometric-consent.md) मांग सकता है। iOS SDK 4.10.0 और बाद के संस्करण यह चरण दिखाते हैं। पुराने संस्करण यह चरण नहीं दिखा सकते: उनके सत्र पहले की तरह चलते हैं, और निर्णय में सहमति को एकत्र नहीं किया गया बताया जाता है (`biometric_consent.reason: "BIOMETRIC_CONSENT_UNSUPPORTED_SDK"`)। यदि आप उन राज्यों में लोगों की पहचान सत्यापित करते हैं, तो अपडेट करें।***## इंस्टॉलेशन`4.0.0` से SDK कई इंस्टॉल करने योग्य वेरिएंट में आता है, ताकि आपके ऐप को केवल उन सुविधाओं की बाइनरी लागत चुकानी पड़े जिनका वह उपयोग करता है। ठीक एक वेरिएंट चुनें: एक CocoaPods subspec और एक SwiftPM लाइब्रेरी प्रोडक्ट।| वेरिएंट | CocoaPods | SwiftPM product | NFC | Auto-detection | OpenSSL | न्यूनतम iOS |
| - | - | - | :-: | :-: | - | - |
| **Core** | `DiditSDK/Core` | `DiditSDKCore` | – | ✓ | कोई नहीं | iOS 13.0+ |
| **AutoDetection** (अप्रचलित) | `DiditSDK/AutoDetection` | `DiditSDKAutoDetection` | – | ✓ | कोई नहीं | iOS 13.0+ |
| **NFC** | `DiditSDK/NFC` | `DiditSDKNFC` | ✓ | ✓ | `3.3.3` बंडल्ड | iOS 15.0+ |
| **All** (डिफ़ॉल्ट) | `DiditSDK/All` | `DiditSDK` | ✓ | ✓ | `3.3.3` बंडल्ड | iOS 15.0+ |- **Core**: सबसे छोटा फ़ुटप्रिंट, जिसमें Didit के अपने हल्के डिटेक्टरों पर दस्तावेज़ और सेल्फ़ी का स्वचालित कैप्चर होता है। इसमें कोई `OpenSSL.xcframework` नहीं होता और कोई CoreNFC रनटाइम नहीं होता
- **AutoDetection**: 4.11.0 से अप्रचलित है और **Core** के समान है; इसके बजाय **Core** का उपयोग करें
- **NFC**: **Core** के साथ NFC पासपोर्ट/eID चिप रीडिंग
- **All**: हर सुविधा। जब आप `DiditSDK` को subspec या product का नाम दिए बिना इंस्टॉल करते हैं, तो यही डिफ़ॉल्ट होता हैहर वेरिएंट आपके ऐप बंडल में क्या जोड़ता है (arm64 Mach-O, `4.9.0` के मुकाबले मापा गया): **Core** \~11.1 MB, **NFC** \~11.7 MB के साथ \~4 MB OpenSSL, **AutoDetection** \~16.0 MB, **All** \~16.6 MB के साथ OpenSSL।
डिटेक्शन मॉडल स्वयं रनटाइम पर डाउनलोड और कैश होते हैं, इसलिए वे आपके ऐप के डाउनलोड आकार में कभी नहीं गिने जाते।`4.11.0` से हर वेरिएंट में स्वचालित कैप्चर Didit के अपने हल्के डिटेक्टरों पर चलता है। TensorFlow Lite अब SDK का हिस्सा नहीं है, और फ़्रेमवर्क छोटा हो गया है क्योंकि उसके अनुवाद बाइनरी के बाहर से लोड होते हैं।`4.6.0` से शिप किए गए फ़्रेमवर्क में Swift ABI डिस्क्रिप्टर (बिल्ड मेटाडेटा, जिसे Xcode हर ऐप में कॉपी करता है पर कभी पढ़ता नहीं) या वे ट्यूटोरियल वीडियो नहीं होते जिन्हें वह वेरिएंट चला नहीं सकता। `4.5.4` या उससे पहले के संस्करण से अपग्रेड करने पर आपका ऐप केवल इसी से लगभग 7-8 MB छोटा हो जाता है, बिना किसी कोड बदलाव के।
App Store बाइनरी को डिलीवरी के लिए कंप्रेस करता है, इसलिए ओवर-द-एयर लागत कम होती है। प्रति-डिवाइस सटीक अंतर के लिए App Store Connect की ऐप साइज़ रिपोर्ट देखें।> [!NOTE]
>
> **NFC** और **All** वेरिएंट `OpenSSL.xcframework` बंडल करते हैं (**OpenSSL 3.3.3**, जो `NFCPassportReader` के ज़रिए `OpenSSL-Universal 3.3.3001` के रूप में शिप होता है), जो NFC चिप प्रमाणीकरण के लिए ज़रूरी है और iOS 15.0+ माँगता है। **4.0.6** तक के संस्करणों में, उसी सहित, OpenSSL `1.1.1s` बंडल था; **4.0.7 और बाद के** संस्करणों में OpenSSL 3.3.3 है, जिसका अपना प्राइवेसी मैनिफ़ेस्ट और कोड साइनेचर है। हमेशा **4.0.7 या बाद का** संस्करण इंस्टॉल करें। ध्यान दें कि अपग्रेड करने से OpenSSL *संस्करण* एक हो जाते हैं, पर *एम्बेड* टकराव दूर नहीं होता: यदि आपके ऐप की किसी और डिपेंडेंसी ने भी `OpenSSL.framework` एम्बेड किया है (वही फ़ाइल नाम, वही `com.github.krzyzanowskim.OpenSSL` बंडल ID), तो संस्करण चाहे जो हो, दोनों प्रतियाँ एम्बेड स्टेप पर टकराती हैं। केवल एक प्रति रखें। उदाहरण के लिए, दूसरे पैकेज को SPM identity से ओवरराइड करके Didit द्वारा प्रकाशित `OpenSSL.xcframework` का उपयोग करें, ताकि बंडल में वही बाइनरी हो जिसके साथ यह SDK बनाया गया था। **Core** और **AutoDetection** वेरिएंट कोई OpenSSL लिंक नहीं करते।`import DiditSDK` आपके ऐप कोड में इंस्टॉल किए गए वेरिएंट से स्वतंत्र एक जैसा रहता है।### Swift Package Manager (अनुशंसित)Xcode का उपयोग करके प्रोजेक्ट में पैकेज जोड़ें:1) **File > Add Package Dependencies** पर जाएँ
2) रिपॉज़िटरी URL दर्ज करें:```
https://github.com/didit-protocol/sdk-ios.git
```3) वर्शन चुनें (या `4.13.2` से **Up to Next Major**) और **Add Package** पर क्लिक करें
4) जब प्रोडक्ट चुनने को कहा जाए, तो अपने वेरिएंट के लिए ठीक एक लाइब्रेरी प्रोडक्ट चुनें (ऊपर की तालिका देखें)या अपनी `Package.swift` में:```swift theme={null}
dependencies: [
    .package(url: "https://github.com/didit-protocol/sdk-ios.git", from: "4.13.2")
]
```फिर अपने target में ठीक इनमें से एक product जोड़ें:```swift theme={null}
// All (default — NFC + auto-detection)
.product(name: "DiditSDK", package: "DiditSDK")

// Core (no NFC, no auto-detection, no OpenSSL)
.product(name: "DiditSDKCore", package: "DiditSDK")

// AutoDetection (auto-capture, no NFC)
.product(name: "DiditSDKAutoDetection", package: "DiditSDK")

// NFC (NFC passport reading, no auto-detection)
.product(name: "DiditSDKNFC", package: "DiditSDK")
```> [!WARNING]
>
> **Swift Package Manager आपके लिए iOS 15 की न्यूनतम सीमा लागू नहीं करता।** `Package.swift` पूरे पैकेज के लिए `platforms: [.iOS(.v13)]` घोषित करता है, इसलिए Xcode आपको `DiditSDK` या `DiditSDKNFC` को iOS 13 या 14 target में बिना किसी चेतावनी के जोड़ने देगा। फिर भी दोनों `OpenSSL.xcframework` बंडल करते हैं और `NFCPassportReader` के ज़रिए चिप पढ़ते हैं, जिसके लिए **iOS 15.0+** चाहिए। `All` या `NFC` product इस्तेमाल करते समय अपने target का deployment target स्वयं 15.0 पर सेट करें। CocoaPods यह subspec के `deployment_target` के ज़रिए अपने आप लागू करता है।### CocoaPods`DiditSDK` रिपॉज़िटरी में होस्ट किए गए binary podspec के रूप में वितरित होता है (यह CocoaPods Trunk पर नहीं है), इसलिए आपको podspec URL का संदर्भ देना होगा। ठीक एक subspec चुनें:```ruby theme={null}
podspec_url = 'https://raw.githubusercontent.com/didit-protocol/sdk-ios/4.13.2/DiditSDK.podspec'

# All (NFC + auto-detection, iOS 15.0+):
platform :ios, '15.0'
pod 'DiditSDK/All', :podspec => podspec_url

# Core (no NFC, no auto-detection, iOS 13.0+):
# pod 'DiditSDK/Core', :podspec => podspec_url

# AutoDetection (auto-capture, no NFC, iOS 13.0+):
# pod 'DiditSDK/AutoDetection', :podspec => podspec_url

# NFC (NFC passport reading, iOS 15.0+):
# pod 'DiditSDK/NFC', :podspec => podspec_url
````Core` और `AutoDetection` iOS 13 तक डिप्लॉय होते हैं; `NFC` और `All` को `NFCPassportReader` के कारण iOS 15 चाहिए।फिर चलाएँ:```bash theme={null}
pod install
```> [!NOTE]
>
> `pod install` के बाद जनरेट हुई `.xcworkspace` खोलें (`.xcodeproj` नहीं)।> [!NOTE]
>
> **Xcode 15+ rsync त्रुटियाँ**: यदि बिल्ड के दौरान `Operation not permitted` rsync त्रुटियाँ दिखें, तो प्रोजेक्ट पर **Build Settings → User Script Sandboxing** (`ENABLE_USER_SCRIPT_SANDBOXING`) को Debug और Release दोनों के लिए **नहीं** पर सेट करें।### मैन्युअल (XCFramework)हर रिलीज़ हर वेरिएंट के लिए एक XCFramework प्रकाशित करती है। अपने वेरिएंट के zip [GitHub Releases](https://github.com/didit-protocol/sdk-ios/releases) पेज से डाउनलोड करें, फिर `.xcframework` फ़ोल्डरों को Xcode में खींचें और **Embed & Sign** सेट करें।| वेरिएंट | डाउनलोड |
| - | - |
| **Core** | `DiditSDK-Core.xcframework.zip` |
| **AutoDetection** | `DiditSDK-AutoDetection.xcframework.zip` |
| **NFC** | `DiditSDK-NFC.xcframework.zip` + `OpenSSL.xcframework.zip` |
| **All** | `DiditSDK.xcframework.zip` + `OpenSSL.xcframework.zip` |***## अनुमतियाँSDK को निम्नलिखित अनुमतियों की आवश्यकता होती है। इन्हें अपने ऐप की `Info.plist` में जोड़ें:| अनुमति | Info.plist कुंजी | विवरण | आवश्यक |
| - | - | - | - |
| कैमरा | `NSCameraUsageDescription` | दस्तावेज़ स्कैनिंग और चेहरा सत्यापन | ✅ हाँ |
| माइक्रोफ़ोन | `NSMicrophoneUsageDescription` | लाइवनेस जाँच के लिए वीडियो रिकॉर्डिंग | ✅ हाँ |
| फ़ोटो लाइब्रेरी | `NSPhotoLibraryUsageDescription` | डिवाइस की गैलरी से दस्तावेज़ अपलोड करना | ✅ हाँ |
| NFC | `NFCReaderUsageDescription` | पासपोर्ट/ID कार्ड में NFC चिप पढ़ना | ⚠️ केवल पूर्ण SDK |
| स्थान | `NSLocationWhenInUseUsageDescription` | धोखाधड़ी रोकथाम के लिए भू-स्थान | ❌ वैकल्पिक |### उदाहरण Info.plist प्रविष्टियाँ```xml theme={null}
<key>NSCameraUsageDescription</key>
<string>Camera access is required to scan your identity documents for verification.</string>

<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required to record video for liveness verification.</string>

<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access is required to upload document images.</string>

<key>NFCReaderUsageDescription</key>
<string>NFC access is required to read the chip in your identity document.</string>

<key>NSLocationWhenInUseUsageDescription</key>
<string>Location access helps verify your identity and prevent fraud.</string>
```### NFC कॉन्फ़िगरेशनकेवल **NFC** या **All** वेरिएंट इंस्टॉल करने पर आवश्यक। यदि आपने **Core** या **AutoDetection** वेरिएंट इंस्टॉल किया है, तो यह सेक्शन छोड़ दें।चिप वाले पासपोर्ट और ID कार्ड के लिए NFC रीडिंग सक्षम करने हेतु:1) Xcode में **NFC क्षमता जोड़ें**:
   * अपना टारगेट चुनें → **Signing & Capabilities** → **+ Capability** → **Near Field Communication Tag Reading**

2) `Info.plist` में **ISO7816 पहचानकर्ता जोड़ें**:```xml theme={null}
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
    <string>D23300000045737445494420763335</string>
    <string>A0000002471001</string>
    <string>A0000002472001</string>
    <string>00000000000000</string>
    <string>D392F000260100000001</string>
</array>
````D392F000260100000001` SDK को [JPKI](https://docs.didit.me/hi/core-technology/nfc-verification/overview.md#japan-my-number-card-jpki) के ज़रिए जापान का My Number Card पढ़ने देता है: इसके बिना iOS कार्ड की जानकारी SDK को नहीं देता। My Number Card पढ़ना अभी प्रोडक्शन में सक्षम नहीं है, और यह पहचानकर्ता अन्य दस्तावेज़ों पर कोई असर नहीं डालता, इसलिए आप इसे अभी जोड़ सकते हैं।3) **एंटाइटलमेंट जोड़ें** (आपकी `.entitlements` फ़ाइल में):```xml theme={null}
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
    <string>TAG</string>
</array>
```> [!WARNING]
>
> **सिम्युलेटर सीमा (NFC और All वेरिएंट)**: ये वेरिएंट CoreNFC से लिंक होते हैं, और Xcode 12 से `libnfshared.dylib` सिम्युलेटर में उपलब्ध नहीं है। समाधान के लिए [यह Stack Overflow थ्रेड](https://stackoverflow.com/questions/63915728/xcode12-corenfc-simulator-library-not-loaded) देखें। यह **Core** या **AutoDetection** वेरिएंट पर **लागू नहीं** होता। NFC सुविधाओं का परीक्षण केवल वास्तविक डिवाइसों पर करें।> [!NOTE]
>
> ### **App Store समीक्षा (NFC और All वेरिएंट)**: यदि आप **NFC** या **All** वेरिएंट इंस्टॉल करते हैं, तो समीक्षा के दौरान Apple डेमो वीडियो माँग सकता है, क्योंकि NFC से संबंधित कोड SDK बाइनरी का हिस्सा है, भले ही आपका वर्कफ़्लो NFC का उपयोग न करे। Apple को सबमिट करने के लिए हमारा NFC डेमो वीडियो [support@didit.me](mailto:support@didit.me) से माँगें। यह **Core** या **AutoDetection** वेरिएंट पर लागू नहीं होता।***## क्विक स्टार्ट### SwiftUI इंटीग्रेशन```swift theme={null}
import SwiftUI
import DiditSDK

struct ContentView: View {
    var body: some View {
        Button("Verify Identity") {
            // Method 1: UniLink — no backend required
            DiditSdk.shared.startVerification(workflowId: "your-workflow-id")
            
            // Method 2: Backend Session — full parameter control
            // DiditSdk.shared.startVerification(token: "your-session-token")
        }
        .diditVerification { result in
            handleResult(result)
        }
    }
    
    private func handleResult(_ result: VerificationResult) {
        switch result {
        case .completed(let session):
            print("Completed: \(session.status)")
        case .cancelled(let session):
            print("Cancelled")
        case .failed(let error, _):
            print("Failed: \(error.localizedDescription)")
        }
    }
}
```### UIKit इंटीग्रेशन```swift theme={null}
import UIKit
import DiditSDK

class VerificationViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Start verification when ready
        DiditSdk.shared.startVerification(token: "your-session-token")
    }
}
```***## इंटीग्रेशन के तरीकेSDK दो इंटीग्रेशन तरीकों का समर्थन करता है:### तरीका 1: UniLink (सबसे सरल)किसी बैकएंड की आवश्यकता नहीं है। SDK [Didit Console](https://business.didit.me) से आपकी वर्कफ़्लो ID का उपयोग करके सत्र सीधे बनाता है। UniLink तरीका (`startVerification(workflowId:)`) केवल `vendorData` का समर्थन करता है; किसी अन्य सत्र पैरामीटर के लिए तरीका 2 का उपयोग करें।> [!NOTE]
>
> UniLink के ज़रिए सत्र में `vendorData` जोड़ने के लिए, [Didit Console](https://business.didit.me) में **विक्रेता डेटा** विकल्प सक्षम करें।```swift theme={null}
DiditSdk.shared.startVerification(
    workflowId: "your-workflow-id",
    vendorData: "user-123"
)
```### तरीका 2: बैकएंड सत्र (प्रोडक्शन के लिए अनुशंसित)आपका बैकएंड [Create Verification Session API](https://docs.didit.me/hi/sessions-api/create-session.md) (`POST /v3/session/`) के ज़रिए सभी पैरामीटर के समर्थन के साथ सत्र बनाता है (`contact_details`, `expected_details`, `metadata`, `callback` आदि), और फिर `session_token` को SDK को पास करता है।```swift theme={null}
// Your backend creates a session and returns the token
let sessionToken = await yourBackend.createVerificationSession(userId: currentUser.id)

// Pass the token to the SDK
DiditSdk.shared.startVerification(token: sessionToken)
```यह तरीका इन पर आपका पूरा नियंत्रण देता है:- सत्रों को अपने उपयोगकर्ताओं से जोड़ना (`vendor_data`)
- क्रॉस-वैलिडेशन के लिए संपर्क विवरण और अपेक्षित विवरण सेट करना
- कस्टम मेटाडेटा सेट करना
- प्रति सत्र कॉलबैक कॉन्फ़िगर करनायह डेटा (संपर्क विवरण, अपेक्षित विवरण, मेटाडेटा, कॉलबैक) [Create Verification Session API](https://docs.didit.me/hi/sessions-api/create-session.md) को भेजा जाता है।***## कॉन्फ़िगरेशन`DiditSdk.Configuration` के साथ SDK के व्यवहार को अनुकूलित करें:```swift theme={null}
let configuration = DiditSdk.Configuration(
    languageLocale: .spanish,      // Force Spanish language
    showLanguageSelector: true,    // Let the user change language
    fontFamily: "Avenir",          // Custom font (must be registered in your app)
    loggingEnabled: true,          // Enable debug logging
    showCloseButton: true,         // Show close (X) button on step screens
    showExitConfirmation: true,    // Show confirmation dialog when user taps close
    closeOnComplete: false         // Don't auto-dismiss on completion
)

DiditSdk.shared.startVerification(
    token: "your-session-token",
    configuration: configuration
)
```### कॉन्फ़िगरेशन विकल्प| गुण | प्रकार | डिफ़ॉल्ट | विवरण |
| - | - | - | - |
| `languageLocale` | `SupportedLanguage?` | डिवाइस लोकेल | किसी विशिष्ट भाषा को बाध्य करें |
| `showLanguageSelector` | `Bool` | `false` | स्वागत स्क्रीन पर वेब-शैली भाषा चयनकर्ता दिखाएँ |
| `fontFamily` | `String?` | सिस्टम फ़ॉन्ट | कस्टम फ़ॉन्ट परिवार का नाम (आपके ऐप में `Info.plist` में `UIAppFonts` के माध्यम से पंजीकृत होना चाहिए) |
| `loggingEnabled` | `Bool` | `false` | SDK डीबग लॉगिंग सक्षम करें |
| `showCloseButton` | `Bool` | `true` | सत्यापन चरण की स्क्रीन पर बंद करने (X) बटन दिखाएँ |
| `showExitConfirmation` | `Bool` | `true` | जब उपयोगकर्ता बाहर निकलने का प्रयास करे, तब पुष्टि संवाद दिखाएँ |
| `closeOnComplete` | `Bool` | `false` | पूरा होने पर सत्यापन UI स्वतः बंद करें (Web SDK समकक्ष: `closeModalOnComplete`) |
| `defaultDocumentCamera` | `CameraLens` | `.back` | दस्तावेज़ कैप्चर स्क्रीन खुलने पर उपयोग किया जाने वाला लेंस |
| `defaultLivenessCamera` | `CameraLens` | `.front` | चेहरे (लाइवनेस) कैप्चर स्क्रीन खुलने पर उपयोग किया जाने वाला लेंस |
| `showDocumentCameraSwitchButton` | `Bool` | `true` | दस्तावेज़ कैप्चर स्क्रीन पर कैप्चर के दौरान कैमरा स्विचर दिखाएँ |
| `showLivenessCameraSwitchButton` | `Bool` | `true` | चेहरा कैप्चर स्क्रीन पर कैप्चर के दौरान कैमरा स्विचर दिखाएँ |### कैमरा विकल्पकैमरा विकल्प [Web SDK के कैमरा विकल्पों](https://docs.didit.me/hi/integration/web-sdks/javascript-sdk.md#कैमरा-विकल्प) से मेल खाते हैं।
प्रत्येक लेंस `.front` या `.back` होता है।
यदि डिवाइस में अनुरोधित लेंस नहीं है, तो SDK उसके पास मौजूद पहला कैमरा उपयोग करता है।
कैमरा स्विचर उन डिवाइसों पर भी छिपा रहता है जिनमें केवल एक कैमरा है।
किसी स्विचर विकल्प को `false` पर सेट करें ताकि उपयोगकर्ता उस चरण के डिफ़ॉल्ट लेंस तक सीमित रहे।```swift theme={null}
let configuration = DiditSdk.Configuration(
    defaultLivenessCamera: .back,
    showLivenessCameraSwitchButton: false
)
```> [!NOTE]
>
> **थीमिंग और रंग**: रंग, बैकग्राउंड और इंट्रो स्क्रीन की सेटिंग्स SDK कॉन्फ़िगरेशन में नहीं, बल्कि Didit Console में आपकी [व्हाइट लेबल सेटिंग्स](https://business.didit.me) के माध्यम से कॉन्फ़िगर की जाती हैं। इससे सभी प्लेटफ़ॉर्म पर एक समान ब्रांडिंग सुनिश्चित होती है।> [!NOTE]
>
> विकल्प `showLanguageSelector`, `showCloseButton`, `showExitConfirmation`, और `closeOnComplete` Web SDK के `DiditSdkConfiguration` से मेल खाते हैं। मोबाइल-विशिष्ट विकल्प `languageLocale` और `fontFamily` इसलिए मौजूद हैं क्योंकि मोबाइल SDK पूरा सत्यापन UI नेटिव रूप से रेंडर करता है (जबकि Web SDK इसे iframe के अंदर होस्टेड फ्रंटएंड को सौंपता है)।***## भाषा समर्थनSDK **54 भाषाओं** का समर्थन करता है। यदि कोई भाषा निर्दिष्ट नहीं है, तो SDK डिवाइस लोकेल का उपयोग करता है और अंग्रेज़ी को फ़ॉलबैक के रूप में उपयोग करता है।```swift theme={null}
// Use device locale (default)
let config = DiditSdk.Configuration()

// Force specific language
let config = DiditSdk.Configuration(languageLocale: .french)

// Let the user change language on the welcome screen
let config = DiditSdk.Configuration(showLanguageSelector: true)

// Detect device locale programmatically
let deviceLanguage = SupportedLanguage.fromDeviceLocale()
```**[समर्थित सभी भाषाएँ देखें →](https://docs.didit.me/hi/integration/supported-languages.md)*****## उन्नत सत्र पैरामीटरउन्नत सत्र पैरामीटर (`contact_details`, `expected_details`, `metadata`, `callback`) के लिए **Backend Session** विधि का उपयोग करें। आपका बैकएंड [Create Verification Session API](https://docs.didit.me/hi/sessions-api/create-session.md) को पूर्ण पैरामीटर के साथ कॉल करता है, फिर `session_token` SDK को पास करता है।***## परिणाम संभालना`VerificationResult` enum सत्यापन का परिणाम देता है:### परिणाम के केस| केस | विवरण |
| - | - |
| `.completed(session:)` | सत्यापन प्रवाह पूरा हुआ (परिणाम के लिए `session.status` देखें) |
| `.cancelled(session:)` | उपयोगकर्ता ने सत्यापन प्रवाह रद्द किया |
| `.failed(error:session:)` | सत्यापन के दौरान एक त्रुटि हुई |### SessionData गुण| गुण | प्रकार | विवरण |
| - | - | - |
| `sessionId` | `String` | अद्वितीय सत्र पहचानकर्ता |
| `status` | `VerificationStatus` | `.approved`, `.pending`, या `.declined` |
| `country` | `String?` | देश कोड (ISO 3166-1 alpha-3) |
| `documentType` | `String?` | सत्यापन के लिए उपयोग किया गया दस्तावेज़ प्रकार |### त्रुटि प्रकार| त्रुटि | विवरण |
| - | - |
| `.sessionExpired` | सत्र समय-सीमा समाप्त हो चुका है |
| `.networkError` | नेटवर्क कनेक्टिविटी समस्या |
| `.cameraAccessDenied` | कैमरे की अनुमति नहीं मिली है |
| `.unknown(String)` | अन्य त्रुटि, संदेश के साथ |### कनेक्शन खो जानायदि सत्यापन के दौरान डिवाइस का कनेक्शन टूट जाता है, तो SDK किसी चरण को लोड होते रहने देने के बजाय उसे "इंटरनेट कनेक्शन नहीं है" स्क्रीन से ढक देता है।
यह पृष्ठभूमि में लगातार जाँच करता रहता है और जैसे ही Didit तक पहुँचा जा सके, स्क्रीन अपने आप बंद हो जाती है। उपयोगकर्ता जिस चरण पर था, वहीं से आगे बढ़ता है।
स्क्रीन **पुनः प्रयास करें** और, जब `showCloseButton` `true` हो (डिफ़ॉल्ट), **सत्यापन से बाहर निकलें** विकल्प देती है।
बाहर निकलने पर सत्यापन `.failed(error: .networkError, session:)` के साथ समाप्त हो जाता है, ताकि आपका ऐप जान सके कि उपयोगकर्ता कनेक्शन के कारण चला गया।### परिणाम संभालने का पूरा उदाहरण```swift theme={null}
.diditVerification { result in
    switch result {
    case .completed(let session):
        switch session.status {
        case .approved:
            print("✅ Approved! Session: \(session.sessionId)")
            // User is verified - grant access
            
        case .pending:
            print("⏳ Under review. Session: \(session.sessionId)")
            // Show "verification in progress" UI
            
        case .declined:
            print("❌ Declined. Session: \(session.sessionId)")
            // Handle declined verification
        }
        
    case .cancelled(let session):
        if let session = session {
            print("🚫 Cancelled session: \(session.sessionId)")
        }
        // User chose to cancel - maybe show retry option
        
    case .failed(let error, let session):
        print("⚠️ Error: \(error.localizedDescription)")
        // Handle error - show retry or contact support
    }
}
```***## सत्यापन को प्रोग्रामेटिक रूप से बंद करना> [!NOTE]
>
> DiditSDK **3.6.0+** में उपलब्ध।होस्ट ऐप `DiditSdk.shared.dismiss()` के माध्यम से सक्रिय सत्यापन को प्रोग्रामेटिक रूप से समाप्त कर सकता है। जब होस्ट ऐप को स्क्रीन अपने नियंत्रण में लेनी हो, उदाहरण के लिए जब ऐप बैकग्राउंड में जाए, तब सत्यापन को बंद करने का यह अनुशंसित तरीका है।```swift theme={null}
DiditSdk.shared.dismiss()
````dismiss()` SDK की सामान्य पूर्णता पाइपलाइन से होकर गुजरता है: यह प्रस्तुत UI को बंद करता है, आंतरिक स्थिति को रीसेट करता है, और यदि सत्र बनाया गया था तो वर्तमान `sessionId` के साथ `.diditVerification` हैंडलर को `.cancelled(session:)` के साथ कॉल करता है। जब कोई सत्यापन सक्रिय न हो, तब यह कोई प्रभाव नहीं डालता (no-op)।### उदाहरण: ऐप बैकग्राउंड में जाने पर बंद करना```swift theme={null}
NotificationCenter.default.addObserver(
    forName: UIApplication.didEnterBackgroundNotification,
    object: nil,
    queue: .main
) { _ in
    DiditSdk.shared.dismiss()
}
```> [!WARNING]
>
> सत्यापन बंद करने के लिए `DiditSdk.shared.isPresented = false` **न** सेट करें। यह फ़्लैग केवल false से true होने पर (बढ़त वाले किनारे पर) प्रेज़ेंटेशन को ट्रिगर करता है, और इसे `false` पर सेट करने का कोई प्रभाव नहीं होता। इसी तरह, सबसे ऊपर वाले व्यू कंट्रोलर पर UIKit का `dismiss(animated:)` कॉल करना समर्थित नहीं है: यह SDK की पूर्णता पाइपलाइन को बायपास कर देता है, इसलिए आपका `.diditVerification` हैंडलर कभी फ़ायर नहीं होता।***## SDK स्थिति देखनाआप कस्टम लोडिंग UI के लिए SDK की स्थिति देख सकते हैं:```swift theme={null}
struct CustomView: View {
    @ObservedObject private var sdk = DiditSdk.shared
    
    var body: some View {
        VStack {
            switch sdk.state {
            case .idle:
                Text("Ready to verify")
            case .creatingSession:
                ProgressView("Creating session...")
            case .loading:
                ProgressView("Loading...")
            case .ready:
                Text("Verification in progress")
            case .error(let message):
                Text("Error: \(message)")
            }
        }
    }
}
```***## एंड-टू-एंड उदाहरण (बैकएंड सत्र → iOS SDK → परिणाम)यह पैटर्न प्रोडक्शन-रेडी इंटीग्रेशन है। आपका बैकएंड सत्र बनाता है, आपका iOS ऐप `session_token` प्राप्त करता है, और SDK फ़्लो चलाता है।### 1. बैकएंड: सत्र बनाएँ```ts theme={null}
// Node.js / Express example. Run on your server. NEVER ship DIDIT_API_KEY to the device.
import express from "express";

const app = express();
app.use(express.json());

app.post("/api/verification/start", async (req, res) => {
  const response = await fetch("https://verification.didit.me/v3/session/", {
    method: "POST",
    headers: {
      "x-api-key": process.env.DIDIT_API_KEY!,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      workflow_id: process.env.DIDIT_WORKFLOW_ID,
      vendor_data: req.body.userId, // your stable user id
    }),
  });

  if (!response.ok) {
    return res.status(500).json({ error: `Didit ${response.status}` });
  }

  const { session_id, session_token } = await response.json();
  // Persist session_id <-> userId so you can match the webhook later.
  res.json({ session_id, session_token });
});
```### 2. iOS: एक्सचेंज करें और SDK शुरू करें```swift theme={null}
import SwiftUI
import DiditSDK

struct VerifyButton: View {
    let userId: String
    @State private var error: String?

    var body: some View {
        Button("Verify Identity") {
            Task { await start() }
        }
        .diditVerification { result in
            switch result {
            case .completed(let session) where session.status == .approved:
                // Optimistically reflect success in the UI; rely on the webhook
                // delivered to your backend as the source of truth.
                break
            case .completed(let session):
                print("Terminal status: \(session.status.rawValue)")
            case .cancelled:
                print("User cancelled")
            case .failed(let err, _):
                error = err.localizedDescription
            }
        }
    }

    private func start() async {
        do {
            var req = URLRequest(url: URL(string: "https://your-backend.example.com/api/verification/start")!)
            req.httpMethod = "POST"
            req.setValue("application/json", forHTTPHeaderField: "Content-Type")
            req.httpBody = try JSONEncoder().encode(["userId": userId])

            let (data, _) = try await URLSession.shared.data(for: req)
            struct Payload: Decodable { let session_token: String }
            let payload = try JSONDecoder().decode(Payload.self, from: data)

            await MainActor.run {
                DiditSdk.shared.startVerification(token: payload.session_token)
            }
        } catch {
            self.error = error.localizedDescription
        }
    }
}
```### 3. बैकएंड: webhook के माध्यम से अंतिम निर्णय प्राप्त करेंSDK का परिणाम UI फ़ीडबैक के लिए सुविधाजनक है, लेकिन आधिकारिक परिणाम webhook के माध्यम से आता है। HMAC सत्यापन के लिए [Webhooks मार्गदर्शिका](https://docs.didit.me/hi/integration/webhooks.md) देखें।```ts theme={null}
app.post("/api/webhooks/didit", express.raw({ type: "application/json" }), (req, res) => {
  // 1. Verify the X-Signature header (see Webhooks docs)
  // 2. Parse the body
  const event = JSON.parse(req.body.toString());
  if (event.webhook_type === "status.updated") {
    // event.session_id, event.status ("Approved" | "Declined" | "In Review" | ...)
    // Look up the user by session_id and update their verification state.
  }
  res.sendStatus(200);
});
```***## संपूर्ण SwiftUI उदाहरण```swift theme={null}
import SwiftUI
import DiditSDK

struct HomeView: View {
    @State private var resultMessage: String?
    @State private var isVerified = false
    
    var body: some View {
        VStack(spacing: 24) {
            if isVerified {
                Image(systemName: "checkmark.circle.fill")
                    .font(.system(size: 64))
                    .foregroundColor(.green)
                Text("Identity Verified")
                    .font(.title2)
            } else {
                Button("Verify Identity") {
                    startVerification()
                }
                .font(.headline)
                .padding(.horizontal, 32)
                .padding(.vertical, 16)
                .background(Color.blue)
                .foregroundColor(.white)
                .cornerRadius(12)
            }
            
            if let message = resultMessage {
                Text(message)
                    .foregroundColor(.secondary)
                    .multilineTextAlignment(.center)
                    .padding()
            }
        }
        .diditVerification { result in
            handleResult(result)
        }
    }
    
    private func startVerification() {
        let config = DiditSdk.Configuration(
            languageLocale: .english
        )
        
        // Method 1: UniLink — no backend required
        DiditSdk.shared.startVerification(
            workflowId: "your-workflow-id",
            vendorData: "user-123",
            configuration: config
        )
        
        // Method 2: Backend Session — full parameter control
        // DiditSdk.shared.startVerification(
        //     token: "your-session-token",
        //     configuration: config
        // )
    }
    
    private func handleResult(_ result: VerificationResult) {
        switch result {
        case .completed(let session):
            if session.status == .approved {
                isVerified = true
            }
            resultMessage = """
                Status: \(session.status.rawValue)
                Session: \(session.sessionId)
                Country: \(session.country ?? "N/A")
                Document: \(session.documentType ?? "N/A")
                """
                
        case .cancelled(let session):
            resultMessage = "Cancelled - Session: \(session?.sessionId ?? "unknown")"
            
        case .failed(let error, _):
            resultMessage = "Failed: \(error.localizedDescription)"
        }
    }
}
```***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.