Get Started With MatrixScan Count

What is MatrixScan Count?

MatrixScan Count is an out-of-the-box scan and count solution for counting and receiving multiple items at once, in which user interface (UI) elements and interactions are built into a workflow.

UI Overview

  • MatrixScan Count leans on the familiar paradigm of a camera, including a shutter button that the user operates in order to initiate scanning.

  • The user is initially guided to “Tap shutter to scan items”.

  • A loading indicator is present for a split second, indicating to hold still while scanning is in progress.

  • An initial calibration may be triggered after the scanning phase if the user stands too far away from or too close to the items.

  • Feedback is overlaid as augmented reality (AR) icons on top of scanned barcodes. A button counter badge and progress bar provide further confirmation of scan. Additionally, AR icons can be used to indicate codes that are unscannable, or items that should not be present.

  • The counter badge simply counts the number of codes scanned.

  • The progress bar replaces the counter badge if the user is are scanning against a list of expected codes (for example, against an item list or manifest). It shows how many of the expected codes have been detected.

  • Upon completing the scanning process, if all items have been successfully scanned, you can advance the user to the next scan automatically. Next steps may be finalizing order receipt if all items are present, reviewing the scan list to identify items that shouldn’t be present, or moving on to the next order (Note: The SDK does not include a UI for reviewing the scan list, but a recommended UI for this process can be seen in our Receiving Sample).

MatrixScan Count is implemented through functionality provided by SDCBarcodeCount.


  • The Scandit Data Capture SDK. Check out this guide.

  • A valid Scandit Data Capture SDK license key including MatrixScan AR add-on. You can sign up for a free test account at

Supported Devices

Runs on iOS and selected Android devices. Contact support for more details.

Supported Symbologies

MatrixScan Count supports all symbologies except DotCode, MaxiCode and postal codes (KIX, RM4SCC).

Quick Start Guide

Barcode Count is a data capture mode that implements MatrixScan Count. In this guide you will learn step by step how to add Barcode Count to your application.

Roughly, the steps are:

  1. Create a new Data Capture Context instance

  2. Configure the Barcode Count Mode

  3. Obtain camera instance and set frame source used

  4. Register the listener to be informed when scanned phase is over

  5. Set capture view and AR overlays

  6. Set up the camera so that it switches on when you are in scanning view

  7. Store and retrieve scanned barcodes

  8. Reset Barcode Count mode

  9. List and Exit callbacks

1. Create A New Data Capture Context Instance

The first step to add capture capabilities to your application is to create a new Data Capture Context. The context expects a valid Scandit Data Capture SDK license key during construction.

self.context = DataCaptureContext(licenseKey: "-- ENTER YOUR SCANDIT LICENSE KEY HERE --")

2. Configure The Barcode Count Mode

The main entry point for the Barcode Count Mode is the SDCBarcodeCount object. It is configured through SDCBarcodeCountSettings and allows you to register one or more listeners that are informed whenever a scan phase has finished.

For this tutorial, we will set up Barcode Count for tracking EAN13 codes. Change this to the correct symbologies for your use case (for example, Code 128, Code 39…).

let settings = BarcodeCountSettings()
settings.set(symbology: .ean13UPCA, enabled: true)

If you are sure that your environment will only have unique barcodes (i.e. no duplicated values), you can also enable SDCBarcodeCountSettings.expectsOnlyUniqueBarcodes. This option improves scanning performance as long as you are sure that no duplicates will be present. Next, create a SDCBarcodeCount instance with the Data Capture Context and the settings initialized in the previous step:

let barcodeCount = BarcodeCount(context: context, settings: settings)

3. Obtain Camera Instance And Set Frame Source Used

Our recommended camera settings should be used to achieve the best performance and user experience. The following couple of lines show how to get the recommended settings for MatrixScan Count and create the camera from it:

let cameraSettings = BarcodeCount.recommendedCameraSettings

let camera = Camera.default

Because the frame source is configurable, the data capture context must be told which frame source to use. This is done with a call to SDCDataCaptureContext.setFrameSource:completionHandler::


4. Register The Listener To Be Informed When Scanned Phase Is Over

To keep track of the barcodes that have been scanned, implement the SDCBarcodeCountListener protocol and register the listener.

// Register self as a listener to monitor the barcode count session.

SDCBarcodeCountListener.barcodeCount:didScanInSession:frameData: is called when the scan phase has finished and results can be retrieved from SDCBarcodeCountSession.

5. Set Capture View And AR Overlays

MatrixScan Count’s built-in AR user interface includes buttons and overlays that guide the user through the capturing process. By adding a SDCBarcodeCountView the scanning interface (camera preview and scanning UI elements) will be added automatically to your application.

Add a SDCBarcodeCountView to your view hierarchy:

let barcodeCountView = BarcodeCountView(frame: view.bounds, context: context, barcodeCount: barcodeCount)
barcodeCountView.autoresizingMask = [.flexibleWidth, .flexibleHeight]

6. Set Up The Camera So That It Switches On When You Are In Scanning View

The camera is not automatically turned on when you are in a scanning view. You need to set up the camera so that it switches on when needed and it switches off when not needed anymore. Similarly SDCBarcodeCount should also be enabled and disabled. For instance, you should switch off the camera when the SDCBarcodeCountView is not visible anymore (including when the app goes in the background), similarly you want to switch on the camera when the SDCBarcodeCountView is visible (including when the app goes to the foreground). One way to achieve this is the following:

override func viewWillAppear(_ animated: Bool) {
    camera?.switch(toDesiredState: .on)

override func viewDidDisappear(_ animated: Bool) {
    camera?.switch(toDesiredState: .off)

7. Store And Retrieve Scanned Barcodes

The values captured as part of the scanning process are part of the session, and the session is not accessible outside SDCBarcodeCountListener.barcodeCount:didScanInSession:frameData:. Therefore, we recommend that you store the values to present a list, for example when the user taps the list icon. To do this, make a copy of SDCBarcodeCountSession.recognizedBarcodes:

extension ViewController: BarcodeCountListener {
    func barcodeCount(_ barcodeCount: BarcodeCount,
                      didScanIn session: BarcodeCountSession,
                      frameData: FrameData) {
        // Gather all the recognized barcodes
        let allRecognizedBarcodes ={ $0.value })
        // This method is invoked from a recognition internal thread.
        // Dispatch to the main thread to update the internal barcode list.
        DispatchQueue.main.async {
            // Update the internal list
            self.allRecognizedBarcodes = allRecognizedBarcodes

8. Reset Barcode Count Mode

When the scanning process is over, you need to reset the mode to make it ready for the next process. This clears the list of barcodes scanned and all the AR overlays.

To reset Barcode Count’s scanning process, you need to call the SDCBarcodeCount.reset method.


9. List And Exit Callbacks

The UI includes two icons (buttons) named “List” and “Exit”. The SDK provides the callbacks so you can add the desired action when those icons are tapped by the user.

extension ViewController: BarcodeCountViewUIDelegate {
    func listButtonTapped(for view: BarcodeCountView) {
        // Show the current progress but the order is not completed

    func exitButtonTapped(for view: BarcodeCountView) {
        // The order is completed

Advanced Settings

Scanning Against A List

There is a function to set a list of expected barcodes if you are scanning against a manifest or item list. If this is used, a progress bar is added to the UI, so you can keep track of the process while scanning.

When scanning against a list, the UI will also show red icons to mark scanned barcodes that aren’t present on the list.

let targetBarcodes = Set(arrayLiteral: TargetBarcode(data: "data", quantity: 1))
let captureList = BarcodeCountCaptureList(listener: self, targetBarcodes: targetBarcodes)

Strap Mode

It can be difficult to reach the shutter button if the smart device is attached to the user’s wrist by a strap or similar. In this instance, you can enable a floating shutter button that can be positioned by the end user in a more ergonomically suitable position.

barcodeCountView.shouldShowFloatingShutterButton = true


If you have several types of barcodes on your label/package, you may want to scan only one of them.

In this case, you can filter the others out. This can be done by symbology, symbol count, or setting a regex.

For example, you might want to scan only Code 128 barcodes and no PDF417 ones.

let filterSettings = BarcodeFilterSettings()
filterSettings.excludedSymbologies = Set<Symbology>(.pdf417).map { NSNumber(value: $0.rawValue) }

let barcodeCountSettings = BarcodeCountSettings()
barcodeCountSettings.set(symbology: .code128, enabled: true))
barcodeCountSettings.set(symbology: .pdf417, enabled: true))
barcodeCountSettings.filterSettings = filterSettings

Or, you want to exclude all the barcodes starting with 4 numbers:

let filterSettings = BarcodeFilterSettings()
settings.excludedCodesRegex = "^1234.*"

let barcodeCountSettings = BarcodeCountSettings()
barcodeCountSettings.filterSettings = filterSettings

Clear Screen Button

There are situations in which the user may find it helpful to clean up their screen (i.e. clear all the AR overlays) but keep the list of barcodes scanned.

If this is the case, you can enable the “Clear screen” button.

barcodeCountView.shouldShowClearHighlightsButton = true


If you want to be notified when a user taps on an overlay, you need to implement the SDCBarcodeCountViewDelegate.barcodeCountView:didTapRecognizedBarcode: and SDCBarcodeCountViewDelegate.barcodeCountView:didTapUnrecognizedBarcode: methods.

func barcodeCountView(_ view: BarcodeCountView,
                      didTapRecognizedBarcode trackedBarcode: TrackedBarcode) {
    // Do something with the tapped barcode

func barcodeCountView(_ view: BarcodeCountView,
                      didTapUnrecognizedBarcode trackedBarcode: TrackedBarcode) {
    // Do something with the tapped barcode

Disable UI Elements

The UI is an integral part of MatrixScan Count and we do not recommend that you use it without it. However, if you wish to disable UI elements you can do it as follows.

Disable buttons:

barcodeCountView.shouldShowListButton = false
barcodeCountView.shouldShowExitButton = false
barcodeCountView.shouldShowShutterButton = false

Disable feedback and hints:

barcodeCountView.shouldShowUserGuidanceView = false
barcodeCountView.shouldShowHints = false