# Liveness Detection

```swift
BiometridStandard.getInstance().startLivenessDetection(data: data, customization: customization, i18n i18n, viewController: self, callback: self)
```

| Parameter                                      | Description                                                    |
| ---------------------------------------------- | -------------------------------------------------------------- |
| data: **\[String: Any]?**                      | Data if is necessary to pass information from other step       |
| customization: **Face01WrapperCustomization?** | Class to change layout customization                           |
| i18n: **\[String: String]?**                   | Json with keys and values to override texts of liveness layout |
| viewController: **UIViewController**           | View Controller to open the liveness engine                    |
| callback: **ProcessCallback**                  | callback                                                       |

## Implementation example

```swift
import UIKit
import BiometridStandardSDK

class ViewController: UIViewController, ProcessCallback {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    @IBAction func startLivenessDetectionBtn(_ sender: Any) {
        let data: [String: Any] = ["front": "base64",
                                   "back": "base64",
                                   "doctype": "idcard"]
        let i18n: [String: String] = ["FaceTec_action_ok": "OK",
                                      "FaceTec_action_im_ready": "I'm Ready"]
        let customization = Face01WrapperCustomization()
        customization.showBrandingImage(true)
        BiometridStandard.getInstance().startLivenessDetection(data: docBuilder, customization: customization, i18n: i18n, viewController: self, callback: self)
    }
    
    func livenessResultCallback(response: LivenessResponseDetails?, error: Errors?) {
        if error != nil {
            print(error?.rawValue)
            return
        }
        print("response", response)
    }

    func livenesStateCallback(state: LivenessState, error: Errors?) {
        if error != nil {
            print(error?.rawValue)
            return
        }
        print("state", state)
    }
}

```

## Callback params

<table data-header-hidden><thead><tr><th width="274">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>response: <strong>LivenessResponseDetails?</strong></td><td>Object with the session id, face scan and auditTrail</td></tr><tr><td>error: <strong>Errors?</strong></td><td>Errors associated enum</td></tr></tbody></table>

<table data-header-hidden><thead><tr><th width="274">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>state: <strong>LivenessState</strong></td><td>Liveness current state changes</td></tr><tr><td>error: <strong>Errors?</strong></td><td>Errors associated enum</td></tr></tbody></table>
