Swift
AI Scanning APIs
The Vision SDK supports OCR via cloud-based APIs to extract structured data from various documents like shipping labels, BOLs (Bill of Lading), and item labels. This mode leverages RESTful APIs and requires a valid API key and environment to be configured before making any calls.
π SDK Configuration for Cloud OCR
Before initiating an OCR scan, you must configure the SDK with your cloud API credentials:
π You can obtain your API key and environment details from cloud.packagex.io.
πΈ Capturing an Image for OCR
The SDK provides a CodeScannerView
that enables you to capture an image either manually or via auto capture mode. Here's how to set it up:
π§ Delegate Method for OCR Photo Capture
When a photo is successfully captured, the following delegate method is triggered:
Use this method to send the captured image to the cloud OCR endpoint using the provided SDK methods.
π§Ύ Document Types Supported
The Vision SDK cloud OCR supports the following document types:
π¦ Shipping Labels
Extracts structured data such as tracking numbers, courier names, addresses, etc. More details Here
Hereβs an explanation of each parameter in the callScanAPIWith
method used to scan Shipping Labels via the Vision SDK's Cloud OCR API:
callScanAPIWith(...)
β Shipping Label API Method
π¦ π Parameter Breakdown
π Bill of Lading (BOL)
Detects and extracts BOL-specific fields such as carrier information, consignee details, and reference numbers. More details Here
getPredictionBillOfLadingCloud(...)
β BOL API Method
π π Parameter Breakdown
π·οΈ Item Labels
Recognizes SKU, GTIN, price, brand, and other item-level information printed on labels. More details Here
callItemLabelsAPIWith(...)
β Item Label API Method
π·οΈ π Parameter Breakdown
π·οΈ Document Classification
Recognizes the document type and returns the type of a logistics document. More details Here