> For the complete documentation index, see [llms.txt](https://valify.gitbook.io/valify-ios-sdk-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://valify.gitbook.io/valify-ios-sdk-documentation/dockit/ios-native-sdk/sdk-response.md).

# SDK Response

### VIDVDocKitResponse (enum)

Returned from the onDocKitResult() callback:

| **Case**                                                                 | **Description**                                  |
| ------------------------------------------------------------------------ | ------------------------------------------------ |
| success(data: VIDVDocumentKitResult)                                     | SDK session completed successfully               |
| serviceFailure(code: Int, message: String, data: VIDVDocumentKitResult?) | Backend or validation failure                    |
| exit(step: String, data: VIDVDocumentKitResult?)                         | User exited manually                             |
| builderError(code: Int, message: String)                                 | Configuration error prevented SDK from launching |

#### Implement Result Callback

```swift
extension ViewController: VIDVDocKitDelegate {
    func onDocKitResult(_ result: VIDVDocKitResponse) {
        switch result {
        case let .success(data):
            // Handle success with extractedData and sessionID


        case let .serviceFailure(code, message, data):
            // Handle API or processing error


        case let .exit(step, data):
            // Handle user exit at a specific step


        case let .builderError(code, message):
            // Handle configuration issue before SDK starts
        }
    }
}
```

### VIDVDocumentKitResult (class)

| **Field**     | **Type**           | **Description**                             |
| ------------- | ------------------ | ------------------------------------------- |
| sessionID     | String?            | Unique ID for SDK session                   |
| extractedData | \[String: String]? | Key-value map of OCR results                |
| captures      | \[String: String]? | Base64-encoded images (front, back)         |
| hmacData      | \[String]?         | Optional HMAC data for integrity validation |

#### 🖼 Captures&#x20;

<details>

<summary>Egyptian National ID</summary>

| **Field**       | **Type** | **Description**    |
| --------------- | -------- | ------------------ |
| egy\_front\_nid | String   | Base64 front image |
| egy\_back\_nid  | String   | Base64 back image  |

</details>

<details>

<summary>MRZ Passport</summary>

| **Field**     | **Type** | **Description**    |
| ------------- | -------- | ------------------ |
| egy\_passport | String   | Base64 front image |

</details>

<details>

<summary>Tunisian National ID</summary>

| **Field**            | **Type** | **Description**    |
| -------------------- | -------- | ------------------ |
| tunisian\_front\_nid | String   | Base64 front image |
| tunisian\_back\_nid  | String   | Base64 back image  |

</details>

<details>

<summary>Algerian National ID</summary>

| **Field**            | **Type** | **Description**    |
| -------------------- | -------- | ------------------ |
| algerian\_front\_nid | String   | Base64 front image |
| algerian\_back\_nid  | String   | Base64 back image  |

</details>

🧾**ExtractedData**&#x20;

<details>

<summary><code>extractedData</code>Map&#x3C;String,String?> (Egyptian National ID)</summary>

* `nid` \<string>
* `first_name` \<string>
* `full_name` \<string>
* `street` \<string>
* `front_nid`  \<string>
* `serial_number` \<string>
* `back_nid` \<string>
* `release_date` \<string>
* `gender` \<string>
* `marital_status` \<string>
* `profession`\<string>
* `religion` \<string>
* `husband_name`  \<string>
* `date_of_birth` \<string>
* `age` \<string>
* `birth_governorate` \<string>
* `gender` \<string>
* `police_station` \<string>
* `governorate`\<string>
* `expiry_date` \<string><br>

</details>

<details>

<summary><code>extractedData</code> Map&#x3C;String,String?> (MRZ Passport)</summary>

* `name` \<string>
* `surname` \<string>
* `date_of_birth` \<string>
* `nationality`  \<string>
* `passport_number` \<string>
* `sex` \<string>
* `expiration_date` \<string><br>

</details>

<details>

<summary><code>extractedData</code> Map&#x3C;String,String?> (Tunisian National ID)</summary>

* `nid` \<string>
* `first_name` \<string>
* `last_name` \<string>
* `father_name` \<string>
* `husband_name`  \<string>
* `birthdate` \<string>
* `birthplace` \<string>
* `mother_name` \<string>
* `profession` \<string>
* `address` \<string>
* `issue_date`\<string>
* `thumbprint_code` \<string>

</details>

<details>

<summary><code>extractedData</code> Map&#x3C;String,String?> (Algerian National ID)</summary>

* `nid` \<string>
* `first_name` \<string>
* `surname` \<string>
* `date_of_birth` \<string>
* `place_of_birth` \<string>
* `blood_type` \<string>
* `gender`\<string>
* `issuance_date`\<string>
* `serial_no`\<string>
* `issuing_authority`\<string>
* `expiration_date` \<string>

</details>

***

### 🔍 Example Output

Example result handling inside the callback:

```swift
case let .success(data):
    let resultText = """
    Session ID: \(data.sessionID ?? "")
    Document Items: \(data.extractedData?.compactMap { dict in
        dict.key + ": " + (dict.value as? String ?? "")
    }.joined(separator: ", \n ") ?? "None")
    """
    resultTextView.text = resultText
```

{% hint style="info" %}
Note: Not all extracted fields will be populated. Results depend on document quality, lighting, and OCR success.
{% endhint %}
