SDK reference · iOS SDK / iOS Individual Modules

User Consent

The User Consent module shows a custom consent agreement for the user to review and accept. Use it to capture an explicit, recorded agreement at a chosen point in the flow. The SDK records acceptance against the current onboarding session; the exact downstream behavior depends on your Incode Flow or Workflow configuration.

You add this module in code by adding it to your IncdOnboardingFlowConfiguration (flowConfig), as shown on this page. See Integration Approaches for how to define and run the flow.

For acceptance of multiple preconfigured statements on one screen, see Combined Consent. For biometric or machine-learning data consent, see Machine Learning Consent.

Availability: All variants.

  1. Add the module with addUserConsent(title:content:). Both arguments are optional.

    flowConfig.addUserConsent(
        title: "Terms and conditions",
        content: "I agree to the terms and conditions."
    )
    
  2. Add any Approval or Results modules after User Consent.

Example

The example below adds a User Consent module with a title and body to the flow configuration, then handles the result on your IncdOnboardingDelegate.

// Add the module to the flow configuration.
flowConfig.addUserConsent(
    title: "Terms and conditions",
    content: "I agree to the terms and conditions."
)

// Handle the outcome on your IncdOnboardingDelegate.
func onUserConsentGiven(_ result: UserConsentResult) {
    if let error = result.error {
        // A failure occurred while submitting the consent.
        return
    }
    // result.success == true when the user accepted the consent.
}

Configuration Options

Configure the module with addUserConsent().

Option Type Description
title String? Sets the heading shown above the consent body text. Optional; defaults to nil.
content String? Sets the consent body text the user reviews and accepts. Optional; defaults to nil.

Result

User Consent reports its outcome through the onUserConsentGiven(_:) callback on your IncdOnboardingDelegate:

func onUserConsentGiven(_ result: UserConsentResult)

UserConsentResult fields:

  • success: Bool?: true when the user accepted and the consent was submitted successfully.
  • error: IncdError?: The error that occurred, when present; otherwise, nil.

Any failure is surfaced through the error field of the same result.


Was this page helpful?