let smartSelfieEnrollmentScreen = SmileID.smartSelfieEnrollmentScreen(...)let uiKitController =UIHostingController(rootView: smartSelfieEnrollmentScreen)smartSelfieScreen.modalPresentationStyle = .fullScreennavigationController?.present(uiKitController, animated:true)
SmileIDSmartSelfieEnrollment( userId:"random-user-id/generated-user-id",// There are more parameters -- they correspond 1:1 with the native SDK parameters onSuccess: (String? result) {// Your success handling logic }, onError: (String errorMessage) {// Your error handling logic })
If you are authenticating a previously registered user, you should use SmileIDSmartSelfieAuthentication Flutter widget
SmileIDSmartSelfieAuthentication( userId:"random-user-id/generated-user-id",// There are more parameters -- they correspond 1:1 with the native SDK parameters onSuccess: (String? result) {// Your success handling logic }, onError: (String errorMessage) {// Your error handling logic })
⚠️Note: Recommend wrapping this in a component that can be navigated to and out of view due to a known issue with views displaying dialogs particularly on failure and the dialog keeps showing,
On onResult, you will receive a JSON string following the structure:
{"selfieFile":"<path to selfie file>","livenessFiles":"<path to liveness files>","apiResponse": {"code":"...","created_at":true | false,"job_id":true | false,"job_type":"","message":"","partner_id":"","partner_params":"","status":"","updated_at":"","user_id":"", }}
Arguments
userId
The user ID to associate with the SmartSelfie™ Registration. Most often, this will correspond to a unique User ID within your own system. (If not provided at time of Registration, a random user ID will be generated. This field is required for Authentication)
jobId
The job ID to associate with the SmartSelfie™ Registration. Most often, this will correspond to a unique Job ID within your own system. If not provided, a random job ID will be generated.
allowAgentMode
Whether to allow Agent Mode or not. If allowed, a switch will be displayed allowing toggling between the back camera and front camera. If not allowed, only the front camera will be used.
showAttribution
Whether to show the Smile ID attribution or not on the Instructions screen
skipApiSubmission
Whether to capture images and not Submit to the SmileID api, this will return file paths which can be retrieved for later use.
extraPartnerParams
Custom values specific to partners passed as an immutable map
Callback to be invoked when the SmartSelfie™ Registration is complete. The result itself is a SmileIDResult which can either be a SmileIDResult.Success or SmileIDResult.Error
delegate (iOS)
This is the delegate object that is notifed when there is a result from the SmartSelfie™ flow. This class has to conform to SmartSelfieResultDelegate and implement the delegate methods
func didSucceed(selfieImage: Data, livenessImages: [Data], jobStatusResponse: JobStatusReponse) and func didError(error: Error)