Skip to main content

iOS KYC component

KYC due diligence is one of the steps required to onboard consumers onto your app. Weavr provides a KYC component that you can embed in your app. This lets you provide a seamless experience to your user while capturing the required documentation to verify their identity.

Start KYC

Once setup is done you are ready to present the SDK on the screen. Please see this code example for a quick start.

Customizing the look and feel of the KYC component

Refer to SumSub MobileSDK Documentation for detailed information on how to customize UI components in your app.

To create Weavr theme object, you can use:

let lightTheme = WeavrKYCTheme()
let darkTheme = WeavrKYCTheme.dark()
var theme : WeavrKYCTheme = lightTheme

You can customize your fonts, colors, and icons. e.g.:

darkTheme.colors.backgroundCommon = .brown
lightTheme.colors.backgroundCommon = .cyan

Example: Add KYC listeners

UXComponents.kyc.startKyc(vc: self, reference: "109460749869121546",
locale: "",
kycHandlers: { handlers in
switch handlers{
case .tokenExpirationHandler(let onExpire):
//get accessToken again and pass in the following line
onExpire("new access token")
case .verificationHandler(let isApproved):
print("verificationHandler: Applicant is " + (isApproved ? "approved" : "finally rejected"))
case .dismissHandler(_, let vc):
vc.dismiss(animated: true, completion: nil)
}
},
weavrExceptionHandlers: {handlers in
switch handlers {
case .weavrApiExceptionHandler(let exc):
print(exc)
}
},
kycListeners: { listener in
switch listener {
case .onStatusDidChange(let sdk,let prevStatus):
print("onStatusDidChange: [\(sdk.description(for: prevStatus))] -> [\(sdk.description(for: sdk.status))]")
switch sdk.status {
case .ready:
// Technically .ready couldn't ever be passed here, since the callback has been set after `status` became .ready
break

case .failed:
print("failReason: [\(sdk.description(for: sdk.failReason))] - \(sdk.verboseStatus)")

case .initial:
print("No verification steps are passed yet")

case .incomplete:
print("Some but not all of the verification steps have been passed over")

case .pending:
print("Verification is pending")

case .temporarilyDeclined:
print("Applicant has been temporarily declined")

case .finallyRejected:
print("Applicant has been finally rejected")

case .approved:
print("Applicant has been approved")

case .actionCompleted:
print("Applicant action has been completed")
}
case .onEvent(_, let event):
switch event.eventType {
case .stepInitiated:
print("onEvent: Step \(event.description) has been initiated")
case .stepCompleted:
print("onEvent: Step \(event.description) has been completed)")
@unknown default:
print("onEvent: eventType=\(event.description(for: event.eventType)) payload=\(event.payload)")
}
case .onDidDismiss(let sdk):
print("onDidDismiss: sdk has been dismissed with status [\(sdk.description(for: sdk.status))]")
switch sdk.status {
case .failed:
print("failReason: [\(sdk.description(for: sdk.failReason))] - \(sdk.verboseStatus)")
case .actionCompleted:
// the action was performed or cancelled
if let result = sdk.actionResult {
print("Last action result: actionId=\(result.actionId) answer=\(result.answer ?? "<none>")")
} else {
print("The action was cancelled")
}
default:
// in case of an action level, the other statuses are not used for now,
// but you could see them if the user closes the sdk before the level is loaded
break
}
}
})