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 DotSdkConfiguration with DotSdk.Configuration class.
  • Update libraries property of DotSdk.Configuration class.

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 method stop().
  • Remove the DocumentAutoCaptureViewControllerDelegate.documentAutoCaptureViewController(:processed:) callback and implement documentAutoCaptureViewController(:uiStateUpdated:) instead. UiState is an enum, and its case UiState.Running replaces the data previously delivered via the onProcessed() callback.
  • Replace DocumentAutoCaptureViewControllerDelegate.documentAutoCaptureViewController(:captured:) callback with documentAutoCaptureViewController(: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.

  • BgraRawImage has been replaced by the Image class.
  • BgraRawImageFactory has been replaced by ImageFactory.

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:)