Swift
Single Barcode Scanning
Single barcode scanning allows you to detect and process one barcode at a time within a predefined scanning window. This ensures precise detection by limiting the scan area, improving accuracy and performance.
⚙️ Configure the SDK
To enable single barcode scanning, you need to configure the Vision SDK using the configure
method:
🤖 Auto Mode Barcode Scanning
For automatic barcode capture, set the captureMode
to .auto
:
Configuration example:
✋ Manual Mode Barcode Scanning
For manual barcode capture, set the captureMode
to .manual
:
Configuration example:
🎯 Focus Area Configuration
To define the scan region, use the focusImageRect
parameter:
This helps confirm the scanning region visually during development or debugging.
🧭 Detection Indicators
To receive detection indicators (without actual values), implement the following delegate method:
text
: Indicates presence of textbarCode
: Indicates presence of a barcodeqrCode
: Indicates presence of a QR codedocument
: Indicates presence of a document
🔘 Enable Detection Indicators
You can toggle detection indicators as follows:
📦 Delegate Method for Barcode Values
When a barcode is successfully scanned, the following delegate method is called:
❗️Error Handling Delegate
If an error occurs during the barcode scanning process, the following delegate method will be triggered. You can implement this to handle any failures gracefully.
Use this method to log errors, display messages to the user, or perform recovery actions when scanning fails.
🧾 Barcode Object Structure
The DetectedBarcode
object returned in the delegate contains the following properties: