Speed up ID Capture integration with Agent Skills
Install the Scandit plugin and use the /id-capture-ios skill so that your AI coding agent can integrate, debug, and customize ID Capture on iOS following Scandit's recommended patterns. More info →
Run the following command in your project directory. It detects the supported coding agents you have installed and adds the Scandit plugin to each. Re-run it to update.
npx plugins add scandit/skillsPrefer to set it up yourself? Manual installation steps for each agent →
Advanced Configurations
There are several advanced configurations that can be used to customize the behavior of the ID Capture SDK and enable additional features.
Decode EU Driver Licenses
By default, ID Capture doesn’t extract data from the table on the back of European Driver Licenses. If you are interested in this data, you may enable the extraction by calling:
- Swift
- Objective-C
settings.decodeBackOfEuropeanDrivingLicense = true
settings.decodeBackOfEuropeanDrivingLicense = YES;
To use this feature, you will need to include the ScanditIdEuropeDrivingLicense module in your project. See the module overview for details.
Configure Data Anonymization
By default, data extracted from documents is anonymized according to local regulations. See Anonymized Documents for more information.
That means certain data from certain fields won’t be returned, even if it’s present on a document. You control the anonymization level with the following setting:
- Swift
- Objective-C
// Default value:
settings.anonymizationMode = .fieldsOnly
// Sensitive data is additionally covered with black boxes on returned images:
settings.anonymizationMode = .fieldsAndImages
// Only images are anonymized:
settings.anonymizationMode = .imagesOnly
// No anonymization:
settings.anonymizationMode = .none
// Default value:
settings.anonymizationMode = SDCIdAnonymizationModeFieldsOnly;
// Sensitive data is additionally covered with black boxes on returned images:
settings.anonymizationMode = SDCIdAnonymizationModeFieldsAndImages;
// Only images are anonymized:
settings.anonymizationMode = SDCIdAnonymizationModeImagesOnly;
// No anonymization:
settings.anonymizationMode = SDCIdAnonymizationModeNone;
ID Images
Your use can may require that you capture and extract images of the ID document. Use the IdImageType enum to specify the images you want to extract from the CapturedId object.
Face and Cropped Document can be extracted only by either SingleSideScanner with visualInspectionZone enabled or by FullDocumentScanner.
In the case of FullDocumentScanner, if the front & the back side of a document are scanned, Cropped Document and Full Frame are returned for both sides.
For the full frame of the document, you can use setShouldPassImageTypeToResult when creating the IdCaptureSettings object. This will pass the image type to the result, which you can then access in the CapturedId object.
- Swift
- Objective-C
// Holder's picture as printed on a document:
settings.resultShouldContainImage(true, for: .face)
// Cropped image of a document:
settings.resultShouldContainImage(true, for: .croppedDocument)
// Full camera frame that contains the document:
settings.resultShouldContainImage(true, for: .frame)
// Holder's picture as printed on a document:
[settings resultShouldContainImage:YES forImageType:SDCIdImageTypeFace];
// Cropped image of a document:
[settings resultShouldContainImage:YES forImageType:SDCIdImageTypeCroppedDocument];
// Full camera frame that contains the document:
[settings resultShouldContainImage:YES forImageType:SDCIdImageTypeFrame];
Callbacks and Scanning Workflows
The ID Capture Listener provides two callbacks: onIdCaptured and onIdRejected. The onIdCaptured callback is called when an acceptable document is successfully captured, while the onIdRejected callback is called when a document is captured but rejected.
For a successful capture, the onIdCaptured callback provides a SDCCapturedId object that contains the extracted information from the document. This object is specific to the type of document scanned. For example, a SDCCapturedId object for a US Driver License will contain different fields than a SDCCapturedId object for a Passport.
For a rejected document, a SDCRejectionReason is provided in the onIdRejected callback to help you understand why the document was rejected and to take appropriate action. These are:
- NOT_ACCEPTED_DOCUMENT_TYPE: The document is not in the list of accepted documents. In this scenario, you could direct the user to scan a different document.
- INVALID_FORMAT: The document is in the list of accepted documents, but the format is invalid. In this scenario, you could direct the user to scan the document again.
- DOCUMENT_VOIDED: The document is in the list of accepted documents, but the document is voided. In this scenario, you could direct the user to scan a different document.
- TIMEOUT: The document was not scanned within the specified time. In this scenario, you could direct the user to scan the document again.
Receive a result after each side
By default, when ID Capture scans a double-sided document, it calls idCapture(_:didCapture:) only after document recognition is complete. To receive a result after the front side and another after the back side, set IdCaptureSettings.notifyOnSideCapture to true. Your app then gets partial results even if the back-side scan fails. The default is false.
To tell a partial result from a complete one, read CapturedId.isCapturingComplete:
true: ID Capture has captured all sides of a multi-sided document, or the document has a single side.false: Only partial data is available, for example, the front side of a two-sided document.
Both properties are available from SDK version 8.6.0.
The setting takes effect when you create IdCapture with these settings, or when you apply them to an existing IdCapture with IdCapture.apply(_:).
settings.notifyOnSideCapture = true
idCapture.apply(settings)
func idCapture(_ idCapture: IdCapture, didCapture capturedId: CapturedId) {
if capturedId.isCapturingComplete {
// All sides are captured, or the document has a single side.
} else {
// Partial result, for example, the front side of a two-sided document.
}
}
Read visa data from the MRZ
When ID Capture reads the machine-readable zone (MRZ) of a machine-readable visa, it returns visa data parsed from the MRZ in CapturedId.mrzResult. To scan visas, add VisaIcao to IdCaptureSettings.acceptedDocuments and use a scanner that reads the MRZ. For the scanners and documents that support the MRZ, see Supported Documents.
The following table lists the visa-related fields.
| Field | Type | When populated |
|---|---|---|
MrzResult.visaNumber | String? | When a per-country rule maps the visa number from the MRZ. |
MrzResult.visaNumberOfEntries | Int? | Parsed, when possible, from the optional data in MRZ line 2. |
MrzResult.visaMultipleEntries | Bool? | Parsed, when possible, from the optional data in MRZ line 2. |
MrzResult.visaDurationInDays | Int? | Parsed, when possible, from the optional data in MRZ line 2. The value is the duration of stay in days. |
MrzResult.passportNumber | String? | When the MRZ encodes the passport number of the document holder. |
CapturedId.visaNumber | String? | When any captured zone contains the visa number. ID Capture prefers the MRZ value over the value from the visual inspection zone (VIZ). |
CapturedId.passportNumber | String? | When any captured zone contains the passport number. ID Capture prefers the MRZ value over the VIZ value. If anonymization applies to field results, the value can be nil for certain documents. |
MrzResult.passportNumber is available from SDK version 7.0.0. All other fields in the table are available from SDK version 8.6.0. A field is nil when the data isn't available.
For visa data read from the VIZ, use VizResult.visaDetails, available from SDK version 8.4.0.
func idCapture(_ idCapture: IdCapture, didCapture capturedId: CapturedId) {
// Resolved across the captured zones, MRZ preferred over VIZ:
let visaNumber = capturedId.visaNumber
let passportNumber = capturedId.passportNumber
// Parsed from the MRZ only:
if let mrz = capturedId.mrzResult {
let numberOfEntries = mrz.visaNumberOfEntries
let multipleEntries = mrz.visaMultipleEntries
let durationInDays = mrz.visaDurationInDays
}
}
Detect Fake IDs
ID Validate is a fake ID detection software. It currently supports documents that follow the Driver License/Identification Card specification by the American Association of Motor Vehicle Administrators (AAMVA).
Fake ID detection can be performed automatically using the following settings:
- IdCaptureSettings.rejectForgedAamvaBarcodes: Automatically rejects documents whose AAMVA barcode fails authenticity validation.
- IdCaptureSettings.rejectInconsistentData: Automatically rejects documents whose human‑readable data does not match the data encoded in the barcode or MRZ.
To enable ID validation for your subscription, please reach out to Scandit Support.