Installation Guide for barKoder's iOS Barcode Scanner SDK

Please follow these simple steps to integrate our SDK into your iOS project.

Step 1: Create a new group #

Name the group “frameworks”. This name is optional, you can use any label you prefer.

Image 1 - Create New Group

Step 2: Add Barkoder.xcframework and BarkoderSDK.xcframework #

Add these items to the frameworks group (Copy items if needed, Create groups and Add to desired targets).

Image 2 - Add to frameworks

Step 3: Enable Bitcode (set it to NO) #

In Build Settings, set Enable Bitcode to NO as shown in the image.

Image 3 - Build Settings, set Bitcode to NO

Step 4: Update Info.plist #

Open Info.plist with Source Code and add the following changes:

                <key>NSCameraUsageDescription</key>
<string>BKD Scanner requires using camera</string>
            

Or using Property List add “Privacy - Camera Usage Description” and key "BKD Scanner requires using camera”

Image 4 - Property list, Add Camera Usage Description

Step 5: Add BarkoderView as a view #

Import BarkoderSDK and delcare barkoderView as a view

                import UIKit
import BarkoderSDK
class ViewController: UIViewController {
    private var barkoderView: BarkoderView!
    override func viewDidLoad() {
        super.viewDidLoad()
        setupUI()
        setupConstraints()
    }
    private func setupUI() {
        barkoderView = BarkoderView()
        view.addSubview(barkoderView)
    }
    private func setupConstraints() {
        barkoderView.translatesAutoresizingMaskIntoConstraints = false
        barkoderView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
        barkoderView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
        barkoderView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
        barkoderView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
    }
}
            

Step 6: Licensing #

The SDK will scan barcodes even without a license, but certain characters will be marked with asterisks. To prevent this, you can create a trial license or a production license. Follow barkoder.com/register to create a trial license today.  

Step 7: Create Barkoder Config #

Setup the Barkoder Config according to your needs:

To perform scanning, the config property must be properly set.

As mentioned, if the license key is not valid, you will receive results with asterisks inside.

                private func createBarkoderConfig() {
    barkoderView.config = BarkoderConfig(licenseKey: "LICENSE_KEY") { licenseResult in print("Licensing SDK: \(licenseResult)") }

    // Enable QR barcode type
    guard let decoderConfig = barkoderView.config?.decoderConfig else { return }
    decoderConfig.qr.enabled = true
}
            

Step 8: Implement BarkoderResultDelegate protocol #

To receive the scanned results we need to implement this protocol:

                extension ViewController: BarkoderResultDelegate {
    func scanningFinished(_ decoderResults: [DecoderResult], thumbnails: [UIImage]?, image: UIImage?) {
    if let textualData = decoderResults[0].textualData {
      print("Scanned result: ", textualData)
    }
    }
}
            

Step 9: Start the scanning process #

And finally start the scanning process:

                try? barkoderView.startScanning(self)
            

For further assistance, you can submit a ticket through the Issue System of the barKoder Developer Portal. Don't hesitate to request a quote if you have any questions or need additional support.

Page Contents

History:

close

Version #854

Published: 11/29/2024 10:12:56

Created On: 11/29/2024 10:12:56

Modified By: Vangel Ivanov

Published Version

Version #797

Was Published: 11/28/2024 20:51:39

Created On: 11/28/2024 20:51:39

Modified By: Vangel Ivanov

Version #175

Was Published: 08/05/2024 12:44:12

Created On: 08/05/2024 12:44:05

Modified By: Lazar Ilievski

Version #173

Was Published: 08/05/2024 12:28:26

Created On: 08/05/2024 12:28:22

Modified By: Vladimir Lazarevski

Version #172

Was Published: 01/01/1970 00:00:00

Created On: 08/05/2024 12:28:07

Modified By: Vladimir Lazarevski

Version #146

Was Published: 08/03/2024 05:53:41

Created On: 08/03/2024 05:53:20

Modified By: Lazar Ilievski

Version #99

Was Published: 06/16/2024 15:44:05

Created On: 06/16/2024 15:44:01

Modified By: Mitko Nikolov

Version #98

Was Published: 01/01/1970 00:00:00

Created On: 06/16/2024 15:41:47

Modified By: Vladimir Lazarevski

Version #97

Was Published: 06/16/2024 15:41:08

Created On: 06/16/2024 15:41:04

Modified By: Vladimir Lazarevski

Version #96

Was Published: 06/16/2024 15:40:23

Created On: 06/16/2024 15:40:19

Modified By: Vladimir Lazarevski

Version #95

Was Published: 06/16/2024 15:39:47

Created On: 06/16/2024 15:39:42

Modified By: Vladimir Lazarevski

Version #94

Was Published: 06/16/2024 15:33:52

Created On: 06/16/2024 15:33:48

Modified By: Vladimir Lazarevski

Version #60

Was Published: 01/01/1970 00:00:00

Created On: 06/12/2024 12:41:06

Modified By: Trajce Poprizov

Version #5

Was Published: 05/15/2024 13:05:26

Created On: 05/15/2024 13:05:26

Modified By: Trajce Poprizov