# Machine Learning Consent

The Machine Learning Consent module captures the user's consent to process their biometric data for machine-learning purposes. You choose the consent text variant (US, GDPR, or worldwide) that matches your compliance needs.

You add this module in code by adding it to your `IncdOnboardingFlowConfiguration` (`flowConfig`), as shown on this page. See [Integration Approaches](https://developer.incode.com/docs/ios-flow-configuration) for how to define and run the flow.

**Availability**: All variants.

## Add Machine Learning Consent

Add the module to the flow with `addMachineLearningConsent(type:)`. The `type` argument is required. There is no default, so you always pass the regulation variant explicitly.

```swift
flowConfig.addMachineLearningConsent(type: .us)   // .us / .gdpr / .worldwide
```

### Example

The example below adds the module to the flow configuration and handles the result through `IncdOnboardingDelegate`.

```swift
flowConfig.addMachineLearningConsent(type: .us)

func onMachineLearningConsentCompleted(_ result: MachineLearningConsentResult) {
    // Consent step completed. Process the result.
}
```

## Configuration Options

Configure the module with `addMachineLearningConsent()`.

| Option | Type             | Description                                                                                                             |
| ------ | ---------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `type` | `RegulationType` | Selects the consent text variant: `.us`, `.gdpr`, or `.worldwide`. Must be supplied on every call. There is no default. |

## Result

Machine Learning Consent delivers a `MachineLearningConsentResult` to the `onMachineLearningConsentCompleted(_:)` callback on your `IncdOnboardingDelegate`. Its fields are:

- `status: Bool?`: `true` if the consent was submitted successfully; `false` if the user did not consent; `nil` if the result is not yet available.
- `error: IncdError?`: The error that occurred, when present; otherwise, `nil`.

<br />
