ID Capture iOS (Swift/UIKit) Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit ID Capture APIs. The iOS Swift API has changed significantly across major versions, and the native iOS SDK differs substantially from the Android (Kotlin/Java), .NET, Flutter, and React Native SDKs. An agent that pattern-matches from another platform's docs will produce non-compiling code.
Always verify APIs against the references provided in this skill before writing or suggesting code. The most common sources of wrong code:
- The v6 API —
supportedDocuments(a bitmask enum like.idCardVIZ/.dlVIZ),supportedSides, and session-based callbacks (didCaptureIn session:frameData:) were all replaced in v7. Do not emit any of these. - The v7.x API —
settings.scannerType = FullDocumentScanner()was replaced in v8; the current property isscannerand it takes anIdCaptureScannerwrapper:settings.scanner = IdCaptureScanner(physicalDocument: FullDocumentScanner()). - ObjC prefixes — the Objective-C SDK uses an
SDCprefix on all types (SDCIdCapture,SDCCapturedId, etc.). These prefixes do not appear in Swift. Never emitSDCIdCapture,SDCIdCaptureSettings, etc. in Swift code. - Cross-platform drift — Android uses
IdCapture.forDataCaptureContext(...), .NET usesIdCapture.Create(...), Flutter uses a different builder. The Swift API isIdCapture(context:settings:). - Standalone verifier classes —
AamvaBarcodeVerifierandDataConsistencyVerifierdo not exist in the native iOS SDK. Verification is settings-driven: setrejectForgedAamvaBarcodes = true/rejectInconsistentData = trueand readcapturedId.verificationResult. - NFC —
NfcScannerexists on native iOS but is not covered by this skill. If the user asks about NFC, refer them to the official documentation.
Forbidden APIs (commonly hallucinated — do NOT emit these)
| Do NOT write | Use instead |
|---|---|
IdCapture.Create(context, settings) / IdCapture.forDataCaptureContext(...) |
IdCapture(context: context, settings: settings) |
settings.supportedDocuments = [.idCardVIZ, .dlVIZ, ...] |
settings.acceptedDocuments = [IdCard(region: .any), ...] |
settings.supportedSides = .frontOnly |
settings.scanner = IdCaptureScanner(physicalDocument: SingleSideScanner(...)) |
settings.scannerType = FullDocumentScanner() (v7 API) |
settings.scanner = IdCaptureScanner(physicalDocument: FullDocumentScanner()) |
new AamvaBarcodeVerifier(...) / AamvaBarcodeVerifier.Create(...) |
settings.rejectForgedAamvaBarcodes = true + read capturedId.verificationResult.aamvaBarcodeVerification |
new DataConsistencyVerifier(...) |
settings.rejectInconsistentData = true + read capturedId.verificationResult.dataConsistency |
capturedId.barcodeResult |
capturedId.barcode |
capturedId.Images / capturedId.VerificationResult (PascalCase, .NET style) |
capturedId.images / capturedId.verificationResult (camelCase) |
SDCIdCapture / SDCCapturedId / any SDC-prefixed type in Swift |
IdCapture / CapturedId (no prefix in Swift) |
DataCaptureContext.ForLicenseKey(...) (.NET) or DataCaptureContext.forLicenseKey(...) (Android) |
DataCaptureContext.initialize(licenseKey: "...") then DataCaptureContext.shared |
Product Guidance
- Accept only the documents you actually need. Ask the user which document types and regions they expect. Documents not in
acceptedDocumentswill be rejected withRejectionReason.notAcceptedDocumentType. - Pick the scanner that matches the data you need. Ask the user whether they need data from both sides, a specific zone only, or a mobile-presented ID — then choose
FullDocumentScanner,SingleSideScanner, orMobileDocumentScanneraccordingly. See references/advanced.md for details. - Handle
didRejectnot justdidCapture. Rejections (RejectionReason.timeout,.notAcceptedDocumentType,.documentExpired,.holderUnderage,.forgedAamvaBarcode,.inconsistentData, …) are how the user learns why a scan didn't succeed. - Mode co-existence with BarcodeCapture.
IdCaptureandBarcodeCapturecan run together on oneDataCaptureContext(e.g. an airport screen reading a boarding-pass barcode and a passport). Attach each mode to the context (its iOS constructorIdCapture(context:settings:)/BarcodeCapture(context:settings:)), give each its own listener, and toggle each withisEnabled— no need to remove one to add the other. See references/advanced.md. - Be aware of the default anonymization list. The SDK anonymizes certain fields by default to meet regional legal requirements (e.g. document number on German ID cards). If a field is unexpectedly
nil, checkcapturedId.anonymizedFields. See references/advanced.md. - Hand off to the
data-capture-sdkskill for non-ID-Capture questions. If the user asks about Barcode Capture, SparkScan, MatrixScan, Label Capture, or choosing between products, defer to thedata-capture-sdkskill.
Intent Routing
Based on the user's request, load the appropriate reference file before responding:
- Integrating ID Capture from scratch, or any question about document selection, scanner choice, rejection rules, image capture, or reading results (top-level fields or zone-specific mrzResult/vizResult/barcode) → read references/integration.md and follow it.
- USDL verification (forged barcodes, data inconsistency, frontReviewImage), anonymization, BarcodeCapture co-existence, overlay customization, or custom feedback → read references/advanced.md and follow it.
- Upgrading the Scandit iOS SDK version on an existing ID Capture integration (e.g. "migrate from 6.x to 7", "update Scandit to the latest version", "we're on 7.x and the build breaks after bumping packages", code that still uses
supportedDocuments/IdDocumentType/didCaptureIn session:) → read references/migration.md and follow it.
API Usage Policy
Only use APIs that are explicitly documented in the Scandit references below. Do not invent or guess method signatures, parameters, or property names. If unsure whether an API exists or how to call it — or if a compile error occurs — fetch the relevant documentation page before responding. Do not tell the user to check the docs themselves. After answering, always include the relevant link so the user can explore further.
Never construct or guess documentation URLs. Fetch the index page and follow links from there.
References
| Topic | Resource |
|---|---|
| Get Started (iOS) | Get Started (iOS Swift) |
| Advanced topics | Advanced Configurations (iOS) |
| SDK version migration | references/migration.md · Migrate 6→7 · Migrate 7→8 |
| Full API reference | ID Capture API (iOS) |
API surface this skill covers
All classes available on the native iOS SDK. The modern document/scanner API (acceptedDocuments, IdCaptureScanner, FullDocumentScanner) landed at 7.0; the rejection flags and verification result model at 7.6/8.0. This skill targets the current 8.x stable release.
IdCapture—IdCapture(context: DataCaptureContext, settings: IdCaptureSettings);isEnabled(get/set);addListener(_:)/removeListener(_:)(IdCaptureListener);static recommendedCameraSettings;feedback(IdCaptureFeedback);reset();applySettings(_:).IdCaptureSettings—IdCaptureSettings(); properties:scanner(IdCaptureScanner),acceptedDocuments/rejectedDocuments([any IdCaptureDocument]),rejectVoidedIds,rejectExpiredIds,rejectIdsExpiringIn(Duration?),rejectNotRealIdCompliant,rejectForgedAamvaBarcodes,rejectInconsistentData,rejectHolderBelowAge(Int?),anonymizationMode(IdAnonymizationMode); methodssetIncludeImage(_:for:)/includeImage(for:),addAnonymizedField(_:forDocument:),removeAnonymizedField(_:forDocument:).IdCaptureScanner—IdCaptureScanner(physicalDocument: (any PhysicalDocumentScanner)?)andIdCaptureScanner(physicalDocument:mobileDocument:);physicalDocument/mobileDocumentproperties.- Physical scanners:
FullDocumentScanner()— both sides, all zones;SingleSideScanner(enablingBarcode:machineReadableZone:visualInspectionZone:)— single side, selected zones; propsbarcode/machineReadableZone/visualInspectionZone. MobileDocumentScanner—MobileDocumentScanner(enablingIso180135:ocr:);iso180135/ocrprops.iso180135uses ISO 18013-5 QR + Bluetooth handover;ocrreads a mobile document displayed on another device's screen.- Document types (
IdCaptureDocumentprotocol, propsregion: IdCaptureRegion+documentType: IdCaptureDocumentType):IdCard(region:),DriverLicense(region:),Passport(region:),VisaIcao(region:),ResidencePermit(region:),HealthInsuranceCard(region:),RegionSpecific(subtype: RegionSpecificSubtype). IdCaptureRegionenum —.any,.euAndSchengen, and ~250 region values (.us,.uk,.uae,.germany, …).IdCaptureListenerprotocol —idCapture(_:didCapture:)(required),idCapture(_:didReject:reason:)(required).CapturedId—fullName/firstName/lastName(String?),sex/sexType,dateOfBirth/dateOfExpiry/dateOfIssue(DateResult?),nationality/nationalityISO,address,age(Int?),isExpired,document((any IdCaptureDocument)?),issuingCountry(IdCaptureRegion),documentNumber/documentAdditionalNumber,vizResult/mrzResult/barcode/mobileDocumentResult/mobileDocumentOcrResult,images(IdImages),verificationResult(VerificationResult),usRealIdStatus.DateResult—day/month/year(Int).IdImages—face(UIImage?),frame(UIImage?),croppedDocument(side:)(UIImage?).VerificationResult—dataConsistency(DataConsistencyResult?),aamvaBarcodeVerification(AamvaBarcodeVerificationResult?).DataConsistencyResult—allChecksPassed,frontReviewImage(UIImage?).AamvaBarcodeVerificationResult—status(AamvaBarcodeVerificationStatus:.authentic/.likelyForged/.forged).IdCaptureOverlay—IdCaptureOverlay(idCapture:view:);idLayoutStyle(IdLayoutStyle:.rounded/.square),idLayoutLineStyle(IdLayoutLineStyle:.bold/.light),showTextHints,textHintPosition,setFrontSideTextHint(_:)/setBackSideTextHint(_:),capturedBrush/localizedBrush/rejectedBrush.IdCaptureFeedback—IdCaptureFeedback();idCaptured/idRejected(Feedback); staticdefault.DataCaptureContext—DataCaptureContext.initialize(licenseKey:)thenDataCaptureContext.shared;setFrameSource(_:completionHandler:);removeCurrentMode()/removeAllModes().Camera—Camera.default;switch(toDesiredState:)(.on/.off);apply(_:).DataCaptureView—DataCaptureView(context:frame:);autoresizingMask.RejectionReasonenum —.notAcceptedDocumentType,.invalidFormat,.documentVoided,.timeout,.documentExpired,.documentExpiresSoon,.notRealIdCompliant,.holderUnderage,.forgedAamvaBarcode,.inconsistentData.IdAnonymizationModeenum —.none,.fieldsOnly,.imagesOnly,.fieldsAndImages.IdImageTypeenum —.face,.croppedDocument,.frame.IdLayoutStyle/IdLayoutLineStyle/TextHintPosition— overlay appearance enums.
Available on native iOS but NOT covered by this skill
- NFC (
NfcScanner,NfcScannerListener) — native iOS only; covered by a separate skill. - Deserializer (
IdCaptureDeserializer) — available on iOS native but not in scope here.