Skip to main content

Initialization

Initializing Veryfi Lens is a critical step in utilizing its capabilities within your mobile application. In this section, we'll provide detailed instructions on how to correctly initialize Veryfi Lens for every platform.

info
are required to initialize the SDK. If you haven't already obtained configuration credentials yet, please refer to the page for instructions.

1. Import the Lens SDK:

import VeryfiLens

2. Configure your authentication credentials:

tip

Please refer to

section to obtain credentials

Ensure that you

and do not expose or store them in your application's source code or publicly accessible locations.

let CLIENT_ID = "XXX" // replace XXX with your assigned Client Id
let AUTH_USERNAME = "XXX" // replace XXX with your assigned Username
let AUTH_APIKEY = "XXX" // replace XXX with your assigned API Key
let URL = "XXX" // replace XXX with your assigned Endpoint URL

let veryfiLensCredentials = VeryfiLensCredentials(clientId: CLIENT_ID,
username: AUTH_USERNAME,
apiKey: AUTH_APIKEY,
url: URL)

3. Configure your Veryfi Lens Settings.

tip

The full list available Veryfi Lens Settings is available in the

section

let veryfiLensSettings = VeryfiLensSettings()
veryfiLensSettings.autoCaptureIsOn = true
veryfiLensSettings.autoRotateIsOn = true
veryfiLensSettings.documentTypes = ['check']
veryfiLensSettings.galleryIsOn = false
veryfiLensSettings.moreMenuIsOn = false

4. Initialize Lens:

VeryfiLens.shared().configure(with: veryfiLensCredentials, settings: veryfiLensSettings) { success in
if success {
// Start using lens
}
}

5. Enable background upload support. Add the code below to your AppDelegate:

import AWSS3

func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
// Store the completion handler
AWSS3TransferUtility.interceptApplication(application, handleEventsForBackgroundURLSession: identifier, completionHandler: completionHandler)
}