DOT iOS Document 9.0.0
This guide describes how to migrate DOT iOS Document version 8.x to version 9.0. Only the most important changes are highlighted in this guide. For more details, see the iOS Samples.
Migration Steps
Compatibility with DIS
When utilizing DIS for server-side evaluation, ensure compatibility between your DIS version and the corresponding SDK version. Refer to the DIS vs SDKs compatibility table for detailed compatibility information.
Deployment
Changed minimal required iOS version to iOS 13.0. Changed minimal required Xcode version to Xcode 16.1.
SDK initialization
The way DOT SDK libraries are configured has changed.
- Replace
DotSdkConfigurationwithDotSdk.Configurationclass. - Update
librariesproperty ofDotSdk.Configurationclass.
Before
Libraries were provided as a list of DotLibrary instances.
let dotSdkConfiguration = DotSdkConfiguration(
license: Data,
libraries: [DotDocumentLibrary()]
)
try DotSdk.shared.initialize(configuration: dotSdkConfiguration)
After
Libraries are now configured via a single Libraries object, with explicit configuration for each DOT SDK library.
let dotSdkConfiguration = DotSdk.Configuration(
licenseBytes: license,
libraries: .init(
document: DotDocumentLibraryConfiguration()
)
)
try DotSdk.shared.initialize(configuration: dotSdkConfiguration)
UI Document Auto Capture component
The DocumentAutoCaptureViewController class’s API and configuration structure have changed. Existing configuration objects are not compatible with the new API and must be migrated to the new configuration model. Basic migration steps:
- Update configuration.
- Replace the method
stopAsync(...)with the new methodstop(). - Remove the
DocumentAutoCaptureViewControllerDelegate.documentAutoCaptureViewController(:processed:)callback and implementdocumentAutoCaptureViewController(:uiStateUpdated:)instead.UiStateis an enum, and its caseUiState.Runningreplaces the data previously delivered via theonProcessed()callback. - Replace
DocumentAutoCaptureViewControllerDelegate.documentAutoCaptureViewController(:captured:)callback withdocumentAutoCaptureViewController(:finished:)callback.
Before
let configuration = try DocumentAutoCaptureViewController.Configuration(
sessionToken: sessionToken,
qualityAttributeThresholds: DocumentAutoCaptureViewController.Configuration.QualityAttributeThresholdPresets.standard.build(),
minValidFramesInRowToStartCandidateSelection: 2,
candidateSelectionDurationMillis: 2000,
validationMode: .standard,
mrzValidation: .validateAlways,
isDetectionLayerVisible: false,
isTorchEnabled: false,
isVideoCaptureEnabled: true,
cameraFacing: .back,
cameraPreviewScaleType: .fill,
placeholderType: .cornersOnly,
isCameraPreviewVisible: true
)
let viewController = DocumentAutoCaptureViewController(configuration: configuration)
extension SampleViewController: DocumentAutoCaptureViewControllerDelegate {
func documentAutoCaptureViewController(:processed:) {
//...
}
func documentAutoCaptureViewController(:captured:) {
//...
}
}
After
let configuration = try DocumentAutoCaptureViewController(
configuration: .init(
baseConfiguration: .init(
common: .init(sessionToken: ""),
camera: .init(
facing: .back,
previewScaleType: .fill,
isTorchEnabled: false,
isVideoCaptureEnabled: true,
isPreviewVisible: true
),
autoCapture: .init(minValidSamplesInRowToStartCandidateSelection: 2, candidateSelectionDurationMillis: 2000),
qualityAttributeThresholds: DocumentAutoCaptureQualityAttributeThresholds.Presets.standard.build(),
validationMode: .standard,
mrzValidation: .requirePresenceAndValidity
),
isDetectionLayerVisible: false,
placeholder: .Visible(type: .cornersOnly)
)
)
let viewController = DocumentAutoCaptureViewController(configuration: configuration)
extension SampleViewController: DocumentAutoCaptureViewControllerDelegate {
func documentAutoCaptureViewController(:uiStateUpdated:) {
//...
}
func documentAutoCaptureViewController(:finished:) {
//...
}
}
Image
Several changes were applied to image-related functionality.
BgraRawImagehas been replaced by theImageclass.BgraRawImageFactoryhas been replaced byImageFactory.
Before
var image: BgraRawImage = BgraRawImageFactory.create(cgImage:)
var image: BgraRawImage = BgraRawImageFactory.create(ciImage:ciContext:)
After
var image: Image = ImageFactory.createBgraRawImage(cgImage:)
var image: Image = ImageFactory.createBgraRawImage(ciImage:ciContext:)