1. Swift
  2. Setup

Swift

Setup

Barcode and QR Code scanner framework for iOS. VisionSDK provides a way to detect barcodes and qr codes. It also provides the functionality for information extraction from different kind of logistic labels like shipping labels, inventory labels, bill of ladings, receipts & invoices

Development Requirements

  • iOS 16.0+
  • Swift: 5.7+
  • Xcode Version: 13.0+

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding VisionSDK as a dependency is as easy as adding it to the dependencies value of your Package.swift.

        dependencies: [
    .package(url: "https://github.com/packagexlabs/vision-sdk.git", .upToNextMajor(from: "1.0.0"))
]

      

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate VisionSDK into your Xcode project using CocoaPods, specify it in your Podfile:

        pod 'VisionSDK'

      

Usage

Update Info.plist

Add Privacy - Camera Usage Description to Info.plist file

PermissionSettings

Initialization

In order to use the OCR API for information extraction, you have to set following parameters

  • Constants.apiKey to your API key.
  • Constants.apiEnvironment you also need to specify the API environment that you have the API key for (sandbox or production).
NOTE

Please note that these have to be set before using the API call. You can generate your own API key at cloud.packagex.io. You can find the instruction guide here.

        Constants.apiKey = "your_api_key"
Constants.apiEnvironment = .production

      

Code Samples

You can find the sample code for using the vision-sdk on our github.