> For the complete documentation index, see [llms.txt](https://docs.vida.id/identity-stack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vida.id/identity-stack/verify/kyc-mobile-sdk/integration-overview/ios-sdk/customization/sdk-customization.md).

# SDK Customization

This section covers how developers can customize the KYC SDK's built-in UI, control screen visibility, set the document type, customize tutorial screens, configure localization, and handle errors.

### UI Configuration

The `VIDAKYCUIConfig` class allows comprehensive UI customization:

```swift
let uiConfig = VIDAKYCUIConfig(
    showTutorial: true,
    showConsentScreen: true,
    showDocumentSelection: true,
    hidePassportOption: false,
    hideBrandLogo: false,
    primaryButtonBgColor: UIColor.systemGreen,
    primaryButtonTextColor: UIColor.white,
    primaryButtonCornerRadius: 8.0,
    headerBgColor: UIColor.systemBackground,
    headerTextColor: UIColor.label,
    headerIconsTintColor: UIColor.label,
    cameraOverlayOpacity: 1.0,
    cameraOverlayBgColor: UIColor.black,
    cameraOverlayBlurStyle: .systemMaterialDark,
    cameraOverlayProgressBgColor: UIColor.gray,
    cameraOverlayProgressColor: UIColor.systemGreen,
    fontProvider: myCustomFontProvider(),   // VIDAKYCFontProvider?
    customBrandLogo: myBrandLogoProvider()  // UIImage?
)
```

#### Configuration Options

<table><thead><tr><th width="276.62890625">Option</th><th>Description</th></tr></thead><tbody><tr><td>showTutorial</td><td>Enable or disable the Document OCR tutorial page. This does not affect the Liveness tutorial. To disable the Liveness tutorial independently, return <code>nil</code> from <code>createLivenessTutorialPage</code> in your <code>VIDAKYCViewFactory</code> implementation.</td></tr><tr><td>showConsentScreen</td><td>Enable or disable the consent screen.</td></tr><tr><td>showDocumentSelection</td><td>Enable/disable document selection page. This only controls whether the page is shown. It does not set which document type the SDK captures - see Setting the Document Type.</td></tr><tr><td>hidePassportOption</td><td>Disable passport option in selection</td></tr><tr><td>hideBrandLogo</td><td>Hide the VIDA brand logo.</td></tr><tr><td>primaryButtonBgColor</td><td>Primary button background color</td></tr><tr><td>primaryButtonTextColor</td><td>Primary button text color</td></tr><tr><td>primaryButtonCornerRadius</td><td>Corner radius of primary button</td></tr><tr><td>headerBgColor</td><td>Header navigation background color</td></tr><tr><td>headerTextColor</td><td>Header title text color</td></tr><tr><td>headerIconsTintColor</td><td>Header icons tint color</td></tr><tr><td>cameraOverlayOpacity</td><td>Opacity of camera overlay</td></tr><tr><td>cameraOverlayBgColor</td><td>Camera overlay background color</td></tr><tr><td>cameraOverlayBlurStyle</td><td>Blur style for camera overlay</td></tr><tr><td>cameraOverlayProgressBgColor</td><td>Progress view background color</td></tr><tr><td>cameraOverlayProgressColor</td><td>Progress view color</td></tr><tr><td>fontProvider</td><td>Customers can use VIDAKYCFontProvider to inject custom fonts for all texts within the SDK.</td></tr><tr><td>customBrandLogo</td><td>Provide a custom brand logo image (<code>UIImage</code>).</td></tr></tbody></table>

### Color Customization

You can customize colors to match your app's branding:

{% code expandable="true" %}

```swift
let customColors = VIDAKYCUIConfig(
    primaryButtonBgColor: UIColor(red: 0.0, green: 0.74, blue: 0.37, alpha: 1.0),
    primaryButtonTextColor: .white,
    headerBgColor: .systemBackground,
    headerTextColor: .label,
    cameraOverlayProgressColor: UIColor(red: 0.0, green: 0.74, blue: 0.37, alpha: 1.0)
)
```

{% endcode %}

***

### Setting the Document Type

Use the `defaultDocumentType` parameter during SDK initialization to explicitly set which document type the SDK should capture. This is especially useful when you hide the built-in document selection page and want to control the document type programmatically.

**How to Set the Document Type**

Pass `defaultDocumentType` when calling `vidaKYC.initialize()`:

{% code expandable="true" %}

```swift
vidaKYC.initialize(
    kycConfig: kycConfig,
    viewFactory: tutorialScreensFactory,
    defaultDocumentType: .myTentera,
    sdkRegion: getSelectedSdkRegion(),
    passportCountryCode: countryCode,
    presentNavigationController: navigationController,
    languageCode: "id"
)
```

{% endcode %}

#### Supported Values

`defaultDocumentType` supports the following values:

<table><thead><tr><th width="440.23828125">Card Type</th><th>Description</th></tr></thead><tbody><tr><td><code>.KTP</code></td><td>Indonesian national ID card</td></tr><tr><td>Malaysian Cards (<code>.myKAD</code>,<code>.myKAS</code>,<code>.myPR</code>, <code>.myTentera</code>)</td><td>Malaysia Identity Card</td></tr><tr><td><code>.passport</code></td><td>Passport</td></tr><tr><td><code>.DL</code></td><td>Driver's License</td></tr></tbody></table>

#### Default behaviour

If `defaultDocumentType` is not set, the SDK uses the default document type for the flow:

<table><thead><tr><th width="304.48828125">Flow</th><th>Default document type</th></tr></thead><tbody><tr><td>Indonesia</td><td>KTP</td></tr><tr><td>Malaysia</td><td>myKAD</td></tr></tbody></table>

#### Usage with Hidden Selection Page

When you hide the built-in selection page using `showDocumentSelection: false` in `VIDAKYCUIConfig`, you should explicitly set `defaultDocumentType` during initialization. If you hide the selection page without setting `defaultDocumentType`, the SDK falls back to the default document type for the region.

{% code expandable="true" %}

```swift
// Step 1: Hide the built-in selection page
let uiConfig = VIDAKYCUIConfig(
    showTutorial: true,
    showConsentScreen: true,
    showDocumentSelection: false, // Hide selection page
    hidePassportOption: false,
    hideBrandLogo: false,
    primaryButtonBgColor: UIColor.systemGreen,
    primaryButtonTextColor: UIColor.white
)

// Step 2: Set the document type during initialization
vidaKYC.initialize(
    kycConfig: kycConfig,
    defaultDocumentType: .myTentera, // Explicitly set document type
    sdkRegion: getSelectedSdkRegion(),
    passportCountryCode: countryCode,
    presentNavigationController: navigationController,
    languageCode: "id"
)
```

{% endcode %}

### Custom Tutorial Screens

You can customize the tutorial screens by using `VIDAKYCViewFactory`. The factory protocol provides two optional functions to provide view controllers for tutorial pages for document capture and liveness. Make sure to call the corresponding action delegate functions within the view controllers to manage the flow.

```swift
public protocol VIDAKYCTutorialActionDelegate {
    func proceed()
    func cancel()
}

public protocol VIDAKYCLivenessTutorialActionDelegate {
    func proceedToLiveness()
    func cancelLiveness()
}

public protocol VIDAKYCViewFactory {
    func createDocCaptureTutorialPage(with delegate: VIDAKYCTutorialActionDelegate) -> UIViewController?
    func createLivenessTutorialPage(with delegate: VIDAKYCLivenessTutorialActionDelegate) -> UIViewController?
}
```

### Localization

The SDK includes built-in support for the following languages:

* English (en) - Default
* Indonesian (id)

To use a supported language, pass the ISO 639-1 language code when initializing:

```swift
vidaKYC.initialize(
    kycConfig: kycConfig,
    presentNavigationController: navigationController,
    languageCode: "id" // Indonesian
)
```

#### Adding Custom Languages

To add support for additional languages not included in the SDK:

1. Add a Localizable.strings file to your app for the desired language
2. Provide translations for all SDK string keys (refer to the SDK's localization keys)
3. Pass the language code when initializing

The SDK will use your app's localized strings for any languages you provide translations for.

***

### Error Configuration

The `VIDAKYCErrorConfig` class manages error handling and retry logic:

```kotlin
let errorConfig = VIDAKYCErrorConfig(
    supportConfig: supportConfig,
    noOfRetries: 3,
    considerWarnings: false
)
```

#### Support Configuration

```kotlin
let supportConfig = VIDAKYCErrorSupport(
    supportType: .email,
    supportValue: "support@yourcompany.com"
)
```

#### VIDAKYCErrorSupportType

```kotlin
public enum VIDAKYCErrorSupportType: Int {
 	case email
 	case phone
}
```
