DOT iOS Document 6.0.0
This guide describes how to migrate DOT iOS Document version 5.x to version 6.0.0. Only the most important changes are highlighted in this guide. For more details, see the iOS sample.
Migration Steps
DocumentAutoCaptureViewController component
- Class
DocumentAutoCaptureConfiguration.QualityAttributeThresholds
is using Builder pattern. - Added
DocumentAutoCaptureConfiguration.QualityAttributeThresholdPresets.standard
preset. - It is possible to create new
DocumentAutoCaptureConfiguration.QualityAttributeThresholds
, use one of the presets fromDocumentAutoCaptureConfiguration.QualityAttributeThresholdPresets
as is, or modify one of the presets fromDocumentAutoCaptureConfiguration.QualityAttributeThresholdPresets
.
Before
// Create new thresholds
let qualityAttributeThresholds = try DocumentAutoCaptureConfiguration.QualityAttributeThresholds(minConfidence: 0.95, minSize: 0.43, minSharpness: 0.65, brightnessInterval: try .init(min: 0.3, max: 0.75), maxHotspotsScore: 0.004)
let configuration = DocumentAutoCaptureConfiguration(qualityAttributeThresholds: qualityAttributeThresholds)
// Use presets
-
// Modify presets
-
After
// Create new thresholds
let qualityAttributeThresholdsBuilder = DocumentAutoCaptureConfiguration.QualityAttributeThresholds.Builder()
try qualityAttributeThresholdsBuilder.minConfidence(.init(value: 0.95))
let qualityAttributeThresholds = qualityAttributeThresholdsBuilder.build()
let configuration = DocumentAutoCaptureConfiguration(qualityAttributeThresholds: qualityAttributeThresholds)
// Use presets
let qualityAttributeThresholds = DocumentAutoCaptureConfiguration.QualityAttributeThresholdPresets.standard.build()
let configuration = DocumentAutoCaptureConfiguration(qualityAttributeThresholds: qualityAttributeThresholds)
// Modify presets
let qualityAttributeThresholdsBuilder = DocumentAutoCaptureConfiguration.QualityAttributeThresholdPresets.standard
try qualityAttributeThresholdsBuilder
.minConfidence(.init(value: 0.95)) // modify confidence validation threshold
.minSize(nil) // remove size validation threshold
.minSize(.init(value: 0.43)) // add size validation threshold
let qualityAttributeThresholds = qualityAttributeThresholdsBuilder.build()
let configuration = DocumentAutoCaptureConfiguration(qualityAttributeThresholds: qualityAttributeThresholds)