Skip to main content
Version: v2

Migrate to v2

This guide lists the changes you need to make in your iOS app to move from v1 to v2 of the iOS SDK.

The SDK no longer creates transactions: your backend does, and passes the result to your app. Before you update the SDK, update your backend as described in the Platform migration guide, in particular No proxy and Consent.

Installation​

The package is unchanged: MicroblinkPlatform, from https://github.com/microblink/microblink-platform-ios.git. In Xcode, change its dependency rule to Exact Version 2.0.0.

V2 consists of two frameworks:

  • MicroblinkPlatform: our screens, which most integrations use.
  • MicroblinkPlatformEngine: the core library, which also provides the configuration and result types.

You import both, even if you only use our screens.

V2 also needs the scanning SDKs:

  • BlinkIDVerifyUX from https://github.com/microblink/blinkid-verify-ios, Exact Version 4000.0.3.
  • BlinkCardUX from https://github.com/microblink/blinkcard-ios, Exact Version 3001.0.2.
  • For workflows with a face step: BiometricsSDK.xcframework and BiometricsEngine.xcframework, linked and embedded.

Remove the old IDLiveFaceCamera, IDLiveFaceDetection, and IDLiveFaceIAD dependencies. Keep NSCameraUsageDescription in your app's Info.plist.

The minimum iOS version is now iOS 17.0, up from iOS 16.0.

Update your workflows to v2 before you create transactions for v2 of the SDK. The SDK doesn't start a transaction whose workflow has an older major or minor version than the SDK. Our screens show an error instead, and closing it sends .canceled with the reason .unsupportedWorkflowVersion.

Starting a verification​

MicroblinkPlatformSDK and MicroblinkPlatformSDKDelegate are removed. Instead, MicroblinkPlatform.view(configuration:onEvent:) returns a SwiftUI view, and reports what happens through a single closure. Instead of a workflow ID, proxy URL, and consent, you pass the sdkConfiguration your backend got when it created the transaction.

As in v1, you present the SDK, and you dismiss it when it's done. In a UIKit app, wrap the view in a UIHostingController:

// sdkConfiguration is the value your backend got from POST /api/v2/transaction.
let configuration = EngineConfiguration(
service: ServiceSettings(sdkConfiguration: sdkConfiguration)
)

weak var presentedController: UIViewController?

let verificationView = MicroblinkPlatform.view(configuration: configuration) { event in
switch event {
case .finished(let result):
print("Transaction ID:", result.transactionId ?? "none")
print("Outcome:", result.outcome)
case .canceled(let cancelState):
print("User exited:", cancelState.reason)
case .cardScanned:
// The verification continues; don't dismiss.
return
@unknown default:
break
}
presentedController?.dismiss(animated: true)
}

let hostingController = UIHostingController(rootView: verificationView)
hostingController.modalPresentationStyle = .fullScreen
presentedController = hostingController
present(hostingController, animated: true)

In a SwiftUI app, present the view directly, for example with .fullScreenCover, and set the presentation state to false when you receive .finished or .canceled.

Configuration fields​

The configuration only covers the connection to the Platform. As in v1, you customize our screens separately, through MicroblinkPlatformTheme.shared (see Customization).

let configuration = EngineConfiguration(
service: ServiceSettings(
sdkConfiguration: "...",
retryPolicy: NetworkRetryPolicy()
)
)

MicroblinkPlatformServiceSettings is replaced by EngineConfiguration(service: ServiceSettings(sdkConfiguration:)). Here's what happened to each of its fields:

  • workflowId is removed. Your backend sets the workflow when it creates the transaction.
  • url, additionalRequestHeaders, and the proxy paths (getWorkflowInfo, startTransaction, and cancelWorkflow) are removed. The SDK talks to the Platform directly.
  • consent is removed, together with MicroblinkPlatformConsent. Collect the consent in your app before the verification starts; your backend sends it when it creates the transaction.
  • correlationId is removed. Your backend sends it when it creates the transaction, in the correlationId field of POST /api/v2/transaction.
  • ServiceSettings has a new optional retryPolicy, which controls how often the SDK retries a failed or busy request. The default, NetworkRetryPolicy(maxAttempts: 5, retryDelay: 0.5), is a good fit for most apps.

Results​

The three delegate methods become cases of MicroblinkPlatformEvent, which your onEvent closure receives. None of them pass a view controller; you dismiss what you presented.

  • microblinkPlatformSDKDidFinish(viewController:result:) becomes .finished(MicroblinkPlatformResult). It's sent after the user closes the result screen. result.status is replaced by result.outcome, a SessionOutcome. For a completed verification, that's .verification(transactionId:state:), where state is .accept, .reject, or .review. result.transactionId is now optional.
  • microblinkPlatformSDKDidClose(viewController:cancelState:) becomes .canceled(MicroblinkPlatformCancelState). It's also sent when the user closes an error screen that doesn't offer a retry. cancelState.cancelReason is renamed to cancelState.reason, and its type MicroblinkPlatformCancelReason is replaced by CancelReason. The consentDenied reason is removed, because the SDK no longer handles consent. The new unsupportedWorkflowVersion reason means that the workflow is older than the SDK supports.
  • microblinkPlatformSDKDidFinishCardScanStep(viewController:cardScanResult:) becomes .cardScanned(CardScanResult). The verification continues after it, so don't dismiss the SDK. MicroblinkPlatformResultCardScanResult is replaced by CardScanResult. Its fields keep their names: cardNumber, expiryDate, owner, and cvv. cardNumber is now optional, and the new isCardNumberValid says whether the number passed validation.

Customization​

You still customize our screens through MicroblinkPlatformTheme.shared, and set it before you create the view. The properties keep their names, but they now take SwiftUI types instead of UIKit ones:

  • UIColor is replaced by Color.
  • UIFont is replaced by Font.
  • UIImage is replaced by Image.

There are also new general properties: titleColor, subtitleColor, accentColor, backgroundColor, and errorColor.

The document scanning properties (documentScanAlertTitleColor, documentScanOnboardingSheetTitleFont, and so on) are now grouped in MicroblinkPlatformTheme.shared.documentScannerAppearance, with the same names. You can still set them directly on MicroblinkPlatformTheme.shared, but they're now optional. Card scanning can now be customized too, through MicroblinkPlatformTheme.shared.cardScannerAppearance.

Face capture now uses the screens of Microblink's face capture SDK. Customize them through MicroblinkPlatformTheme.shared.faceCaptureAppearance. primaryColor doesn't change the colors of the scanning screens.

localizationBundle and localizationTableName work as before, and the existing translation keys keep their names, except that these are no longer used:

  • mb-mp-consent-*, because the SDK no longer shows a consent screen.
  • mb-mp-face-capture-* and mb-mp-portrait-mode-*, because face capture now uses its own screens.

V2 also adds new keys for its new screens and messages, for example mb-mp-button-continue, mb-mp-result-accept, and mb-mp-upload-camera. If you translate the SDK, add the new keys from the SDK's Localizable.xcstrings to your strings; until you do, the SDK shows its English text for them. Read Localization.