# Development Guide (Face Capture)

### Face Capture

1. Instantiate the configuration object. You must pass a reference to your navigation controller.

```swift
let config = OkaySelfieConfig(navigationController: nav)
```

2. Start the process by calling `start` on `OkayCamSelfie` class. Similarly, you can handle the result in the completion handler.

```swift
OkayCamSelfie.start(
    okaySelfieConfig: config,
    license: yourLicense,
    { filePath, error in
        // handle
    }
)
```

You will only either receieve the `filePath` or an `error`. One will be valid and the other will be `nil`.

### **Configuration**

Modifying the configuration object:

```swift
        let config = OkaySelfieConfig(navigationController: nav)
        config.topLabel.text = "top label text"
        config.topLabel.color = .green
        config.topLabel.size = 14
        config.bottomFrameColor = .darkGray
        config.captureBtnColor = .white
        config.swichBtnConfig.show = true
        config.swichBtnConfig.color = .magenta
        config.confirmBtnConfig.backgroundColor = .blue
        config.confirmBtnConfig.contentColor = .black
        config.retakeBtnConfig.backgroundColor = .orange
        config.retakeBtnConfig.contentColor = .black
        config.width = 250
        config.imageQuality = 1.0
        config.defaultCameraFacing = .back
        config.outputPath = myCustomFilePath
```

Properties on `OkaySelfieConfig`:

| Property            | Default                                                                                                                   | Type                    |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| topLabel            | `OkaySelfieLabelConfig(text: "Please align your face within the frame", color: UIColor.white, size: CGFloat(18))`         | `OkaySelfieLabelConfig` |
| bottomFrameColor    | `UIColor(red: 0.92, green: 0.40, blue: 0.04, alpha: 1.0)`                                                                 | `UIColor`               |
| captureBtnColor     | `UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0)`                                                                 | `UIColor`               |
| swichBtnConfig      | `SwitchBtnConfig(color: UIColor.white, show: false)`                                                                      | `SwitchBtnConfig`       |
| confirmBtnConfig    | `OkayCamBtnConfig(backgroundColor: UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0), contentColor: UIColor.white)` | `OkayCamBtnConfig`      |
| retakeBtnConfig     | `OkayCamBtnConfig(backgroundColor: UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0), contentColor: UIColor.white)` | `OkayCamBtnConfig`      |
| defaultCameraFacing | `OkayCam.CameraDevice.front`                                                                                              | `OkayCam.CameraDevice`  |
| frameColor          | `UIColor.black`                                                                                                           | `UIColor`               |
| outputPath          | `nil`                                                                                                                     | `URL?`                  |
| width               | `nil`                                                                                                                     | `Int?`                  |
| imageQuality        | `1.0 (range 0 - 1.0)`                                                                                                     |                         |

### OkayCamPlus Face Capture

1. &#x20;Start the process by calling `start` on `OkayCamPlus` class. You can handle the result in the completion handler.

```swift
OkayCamPlusSelfie.start(
    viewController: yourViewController,
    license: yourLicense,
    { JSONString, error in
        // handle
    }
)
```

You will only either receive `JSONString` or an `error`. One will be valid and the other will be `nil`.

`JSONString` will return 2 values:

| Result | Description            |
| ------ | ---------------------- |
| selfie | `selfie_image_URLPath` |
| bundle | `base64String`         |

### FaceCapture Plus UI

1. FaceCapture Plus Screen

<figure><img src="/files/1ONsk9i4VR5T3s1l6zPg" alt=""><figcaption></figcaption></figure>

1. FaceCapure API Result (UI is for demo purposes only)

<figure><img src="/files/4urnyL62QGZuD5j7iRlo" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api2-ekycapis.innov8tif.com/okaycam-mobile-sdk/okaycam-plus-mobile-sdk/okaycam-plus-ios/development-guide-face-capture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
