Installation
This page describes how to integrate the Scandit Data Capture SDK into your iOS project. The SDK can be added via:
Prerequisites
Before you begin, make sure you have the following prerequisites in place:
- Latest version of Xcode
- iOS project with a deployment target of iOS 13.0+
- Scandit license key, sign up for a free trial if you don't already have a license key
CocoaPods
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. To integrate the Scandit Data Capture SDK into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'ScanditBarcodeCapture',
# Add the following pods if you want to use additional features
pod 'ScanditIdCapture',
pod 'ScanditParser',
This command also downloads ScanditCaptureCore
as ScanditBarcodeCapture
depends on it.
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
To integrate the Scandit Data Capture SDK into your Xcode project using Carthage, specify it in your Cartfile
:
binary "https://ssl.scandit.com/sdk/download/carthage/ScanditBarcodeCapture.json"
You also need to add ScanditCaptureCore
since ScanditBarcodeCapture
API depends on it.
binary "https://ssl.scandit.com/sdk/download/carthage/ScanditCaptureCore.json"
If applicable for your use case, you can also add the following Carthage binaries:
binary "https://ssl.scandit.com/sdk/download/carthage/ScanditIdCapture.json"
binary "https://ssl.scandit.com/sdk/download/carthage/ScanditParser.json"
Swift Package Manager
To integrate the Scandit Data Capture SDK into your Xcode project using Swift Package Manager, add the frameworks you want to add in the Package Dependencies section of your project.
Add our SPM package repository:
https://github.com/Scandit/datacapture-spm
Or if you prefer checking out git repositories via SSH:
git@github.com:Scandit/datacapture-spm.git
You also need to add ScanditCaptureCore
since ScanditBarcodeCapture
API depends on it, and if applicable for your use case, you can also add the following packages:
ScanditIdCapture
ScanditParser
Add the Frameworks Manually
Adding the frameworks manually is a single step process when using the XCFramework archives.
All you need to do is drag the frameworks into the Frameworks, Libraries, and Embedded Content section of your target. Make sure to select Embed and Sign for the Embed option.
Please note that you will always need at least ScanditCaptureCore.xcframework
which contains the shared functionality used by the other data capture modules.
When building the project, by default Xcode will look for the frameworks in the root folder of the project.
If you choose to copy the frameworks in a different location, don’t forget to update the FRAMEWORK_SEARCH_PATHS
build setting accordingly.
Import in Source Code
To import the Scandit Data Capture SDK into your source code, add the following import statement:
- Swift
- Objective-C
import ScanditCaptureCore
import ScanditBarcodeCapture
import ScanditIdCapture
import ScanditParser
@import ScanditCaptureCore;
@import ScanditBarcodeCapture;
@import ScanditIdCapture;
@import ScanditParser;