Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/partials/_extension-codes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ When add-on codes are enabled the Scandit Data Capture SDK automatically couples
Inside `SDCBarcodeCaptureListener.barcodeCapture:didScanInSession:frameData:` the data can be retrieved from the recognized barcode as follows:

```swift
let barcode = session.newlyRecognizedBarcode[0]
guard let barcode = session.newlyRecognizedBarcode,
let data = barcode.data else {
return
}

let data = barcode.data
let addOnData = barcode.addOnData
if let addOnData = addOnData {
if let addOnData = barcode.addOnData {
// Do something with the data & addOnData.
} else {
// Do something with just the data.
Expand Down
9 changes: 5 additions & 4 deletions docs/partials/_scanning-composite-codes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ There are two potential cases when a barcode of a symbology with enabled composi
Inside `SDCBarcodeCaptureListener.barcodeCapture:didScanInSession:frameData:` the data can be retrieved from the recognized barcode as follows:

```swift
let barcode = session.newlyRecognizedBarcode[0]
guard let barcode = session.newlyRecognizedBarcode,
let data = barcode.data else {
return
}

let data = barcode.data
let compositeData = barcode.compositeData
if let compositeData = compositeData {
if let compositeData = barcode.compositeData {
// Do something with the data & compositeData.
} else {
// Do something with just the data.
Expand Down
8 changes: 4 additions & 4 deletions docs/partials/advanced/_sparkscan-customization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ First you will need to show these buttons:

```sh
// Show the Label Capture, MatrixScan Count, and MatrixScan Find buttons
sparkScanView.labelCaptureButtonVisible = true;
sparkScanView.barcodeCountButtonVisible = true;
sparkScanView.barcodeFindButtonVisible = true;
sparkScanView.isLabelCaptureButtonVisible = true
sparkScanView.isBarcodeCountButtonVisible = true
sparkScanView.isBarcodeFindButtonVisible = true
```

<p align="center">
Expand All @@ -61,4 +61,4 @@ sparkScanView.barcodeFindButtonVisible = true;
<img src="/img/sparkscan/toolbar-buttons.png" alt="Toolbar with Scanning Modes" /><br></br>The toolbar with MatrixScan Find and MatrixScan Count buttons.
</p>

In addition you have to add a listener to the `SparkScanView` via `SparkScanView.setListener()`. You will then receive callbacks when the MatrixScan Find button or MatrixScan Count button is tapped from the toolbar.
In addition you have to add a delegate to the `SparkScanView` via `SparkScanView.uiDelegate`. You will then receive callbacks when the MatrixScan Find button or MatrixScan Count button is tapped from the toolbar.
13 changes: 5 additions & 8 deletions docs/sdks/ios/barcode-capture/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ extension ViewController: BarcodeCaptureListener {
func barcodeCapture(_ barcodeCapture: BarcodeCapture,
didScanIn session: BarcodeCaptureSession,
frameData: FrameData) {
let recognizedBarcodes = session.newlyRecognizedBarcode
for barcode in recognizedBarcodes {
// Do something with the barcode.
}
let recognizedBarcode = session.newlyRecognizedBarcode
// Do something with the barcode.
}
}
```
Expand All @@ -90,7 +88,7 @@ barcodeCapture.addListener(self)

### Rejecting Barcodes

To prevent scanning unwanted codes, you can reject them by adding the desired logic to the `onBarcodeScanned` method. This will prevent the barcode from being added to the session and will not trigger the `onSessionUpdated` method.
To prevent scanning unwanted codes, you can reject them by adding the desired logic to the `didScanIn` method.

The example below will only scan barcodes beginning with the digits `09` and ignore all others, using a transparent brush to distinguish a rejected barcode from a recognized one:

Expand Down Expand Up @@ -138,12 +136,11 @@ camera?.switch(toDesiredState: .on)
When using the built-in camera as frame source, you will typically want to display the camera preview on the screen together with UI elements that guide the user through the capturing process. To do that, add a `SDCDataCaptureView` to your view hierarchy:

```swift
let captureView = DataCaptureView(for: context, frame: view.bounds)
captureView.dataCaptureContext = context
let captureView = DataCaptureView(context: context, frame: view.bounds)
captureView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(captureView)
To visualize the results of barcode scanning, the following overlay can be added:

// To visualize the results of barcode scanning, the following overlay can be added:
let overlay = BarcodeCaptureOverlay(barcodeCapture: barcodeCapture, view: captureView)
```

Expand Down
4 changes: 2 additions & 2 deletions docs/sdks/ios/barcode-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ To generate barcodes, you need to create a [`SDCDataCaptureContext`](https://doc
With the context you can then instantiate a [`SDCBarcodeGeneratorBuilder`](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/barcode-generator-builder.html#class-scandit.datacapture.barcode.generator.BarcodeGeneratorBuilder), and use the method of [`SDCBarcodeGenerator`](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/barcode-generator.html#class-scandit.datacapture.barcode.generator.BarcodeGenerator) for the symbology you are interested in, in this example Code 128.

```swift
let context = DataCaptureContext(licenseKey: licenseKey)
let context = DataCaptureContext(licenseKey: "-- ENTER YOUR SCANDIT LICENSE KEY HERE --")
let builder = BarcodeGenerator.code128BarcodeGeneratorBuilder(with: context)
```

Expand Down Expand Up @@ -69,7 +69,7 @@ To generate barcodes, you need to create a [`SDCDataCaptureContext`](https://doc
With the context you can then instantiate a [`SDCQRCodeBarcodeGeneratorBuilder`](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/barcode-generator-builder.html#class-scandit.datacapture.barcode.generator.QrCodeBarcodeGeneratorBuilder) using the method of [`SDCBarcodeGenerator`](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/barcode-generator.html#class-scandit.datacapture.barcode.generator.BarcodeGenerator) specific for QR codes.

```swift
let context = DataCaptureContext(licenseKey: licenseKey)
let context = DataCaptureContext(licenseKey: "-- ENTER YOUR SCANDIT LICENSE KEY HERE --")
let builder = BarcodeGenerator.qrCodeBarcodeGeneratorBuilder(with: context)
```

Expand Down
19 changes: 9 additions & 10 deletions docs/sdks/ios/label-capture/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ extension YourScanViewController: LabelCaptureBasicOverlayDelegate {
private func brush(for field: LabelField) -> Brush {
let fillColor: UIColor
let strokeColor: UIColor
switch Field(rawValue: field.name) {
switch field.name {
case "<your-barcode-field-name>":
fillColor = .systemCyan.withAlphaComponent(0.5)
strokeColor = .systemCyan
case "<your-expiry-date-field-name>":
fillColor = .systemOrange.withAlphaComponent(0.5)
strokeColor = .systemOrange
case .none:
default:
fillColor = .clear
strokeColor = .clear
}
Expand All @@ -70,7 +70,7 @@ import ScanditLabelCapture

// Create an advanced overlay that allows for custom views to be added over detected label fields
// This is the key component for implementing Augmented Reality features
let advancedOverlay = LabelCaptureAdvancedOverlay(labelCapture: labelCapture, dataCaptureView: dataCaptureView)
let advancedOverlay = LabelCaptureAdvancedOverlay(labelCapture: labelCapture, view: dataCaptureView)

// Configure the advanced overlay with a delegate that handles AR content creation and positioning
advancedOverlay.delegate = self
Expand All @@ -91,9 +91,8 @@ extension YourScanViewController: LabelCaptureAdvancedOverlayDelegate {

// This defines the offset from the anchor point for the label's AR view
func labelCaptureAdvancedOverlay(_ overlay: LabelCaptureAdvancedOverlay,
offsetFor capturedLabel: CapturedLabel,
view: UIView) -> PointWithUnit {
return PointWithUnit(x: 0, y: 0, unit: .pixel)
offsetFor capturedLabel: CapturedLabel) -> PointWithUnit {
return PointWithUnit(x: .zero, y: .zero)
}

// This method is called when a field is detected in a label
Expand Down Expand Up @@ -137,9 +136,9 @@ extension YourScanViewController: LabelCaptureAdvancedOverlayDelegate {

// This defines the offset from the anchor point
func labelCaptureAdvancedOverlay(_ overlay: LabelCaptureAdvancedOverlay,
offsetFor labelField: LabelField,
view: UIView) -> PointWithUnit {
return PointWithUnit(x: 0, y: 22, unit: .dip)
offsetFor capturedField: LabelField,
of capturedLabel: CapturedLabel) -> PointWithUnit {
return PointWithUnit(x: .zero, y: .zero)
}
}
```
Expand Down Expand Up @@ -184,7 +183,7 @@ validationFlowOverlay.applySettings(validationSettings)
To handle validation events, implement the `LabelCaptureValidationFlowOverlayDelegate` protocol.

```swift
extension YourScanViewController: LabelCaptureValidationFlowOverlayDelegate {
extension YourScanViewController: LabelCaptureValidationFlowDelegate {
// This is called by the validation flow overlay when a label has been fully captured and validated
func labelCaptureValidationFlowOverlay(_ overlay: LabelCaptureValidationFlowOverlay,
didCaptureLabelWith fields: [LabelField]) {
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/ios/label-capture/get-started-with-swift-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class LabelCaptureViewController: UIViewController {

extension LabelCaptureViewController: LabelCaptureListener {
func labelCapture(_ labelCapture: LabelCapture,
didUpdateSession session: LabelCaptureSession,
didUpdate session: LabelCaptureSession,
frameData: FrameData) {
// Handle label capture results
// See the main Get Started guide
Expand Down
6 changes: 3 additions & 3 deletions docs/sdks/ios/label-capture/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,22 @@ extension YourScanViewController: LabelCaptureListener {
/*
* Given the label capture settings defined above, barcode data will always be present.
*/
guard let barcodeField = label.field(for: "<your-barcode-field-name>"),
guard let barcodeField = label.fields.first(where: { $0.name == "<your-barcode-field-name>"}),
let barcodeData = barcodeField.barcode?.data else { return }

/*
* The expiry date field is optional.
* Check for nil in your result handling.
*/
let expiryDate = label.field(for: "<your-expiry-date-field-name>").text
let expiryDate = label.fields.first(where: { $0.name == "<your-barcode-field-name>"})?.text

/*
* Emit feedback to notify the user that a label has been captured.
*/
Feedback.default.emit()

DispatchQueue.main.async {
camera?.switch(toDesiredState: .off)
self.camera?.switch(toDesiredState: .off)
labelCapture.isEnabled = false
/*
* Handle the captured barcode and expiry date here.
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/ios/matrixscan-ar/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ settings.set(symbology: .ean13UPCA, enabled: true)
Then create the mode with the previously created settings:

```swift
let mode = BarcodeAr(context: context,
let barcodeAr = BarcodeAr(context: context,
settings: settings)
```

Expand Down
6 changes: 3 additions & 3 deletions docs/sdks/ios/matrixscan-count/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ let filterSettings = BarcodeFilterSettings()
filterSettings.excludedSymbologies = [.pdf417]

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

Or to exclude all the barcodes starting with 4 numbers:

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

let barcodeCountSettings = BarcodeCountSettings()
barcodeCountSettings.filterSettings = filterSettings
Expand Down
4 changes: 2 additions & 2 deletions docs/sdks/ios/matrixscan-count/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ To keep track of the barcodes that have been scanned, implement the [`SDCBarcode

```swift
// Register self as a listener to monitor the barcode count session.
barcodeCount.add(self)
barcodeCount.addListener(self)
```

[`SDCBarcodeCountListener.barcodeCount:didScanInSession:frameData:`](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/barcode-count-listener.html#method-scandit.datacapture.barcode.count.IBarcodeCountListener.OnScan) is called when the scan phase has finished and results can be retrieved from [`SDCBarcodeCountSession`](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/barcode-count-session.html#class-scandit.datacapture.barcode.count.BarcodeCountSession).
Expand Down Expand Up @@ -128,7 +128,7 @@ extension ViewController: BarcodeCountListener {
didScanIn session: BarcodeCountSession,
frameData: FrameData) {
// Gather all the recognized barcodes
let allRecognizedBarcodes = session.recognizedBarcodes.map({ $0.value })
let allRecognizedBarcodes = session.recognizedBarcodes
// This method is invoked from a recognition internal thread.
// Dispatch to the main thread to update the internal barcode list.
DispatchQueue.main.async {
Expand Down
6 changes: 3 additions & 3 deletions docs/sdks/ios/matrixscan-find/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ items.insert(BarcodeFindItem(
Finally, create a [`SDCBarcodeFind`](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/barcode-find.html#class-scandit.datacapture.barcode.find.BarcodeFind) instance with the Data Capture Context and the settings initialized in the previous step:

```swift
let barcodeFind = BarcodeFind(context: context, settings: settings)
mode.setItemsList(items)
let barcodeFind = BarcodeFind(settings: settings)
barcodeFind.setItemList(items)
```

## Setup the `BarcodeFindView`
Expand All @@ -91,7 +91,7 @@ viewSettings.hapticEnabled = true
Next, create a `SDCBarcodeFindView` instance with the Data Capture Context and the settings initialized in the previous step. he BarcodeFindView is automatically added to the provided parent view.

```swift
let barcodeFindView = BarcodeFindView(parentView: view, context: context, barcodeFind: mode, settings: viewSettings)
let barcodeFindView = BarcodeFindView(parentView: view, context: context, barcodeFind: barcodeFind, settings: viewSettings)
```

Last, connect the [`BarcodeFindView`](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/ui/barcode-find-view.html#class-scandit.datacapture.barcode.find.ui.BarcodeFindView) to the iOS view controller lifecycle.
Expand Down
4 changes: 2 additions & 2 deletions docs/sdks/ios/matrixscan-pick/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ let viewSettings = BarcodePickViewSettings()
Next, create a `BarcodePickView` instance with the Data Capture Context and the settings initialized in the previous step. The `BarcodePickView` is automatically added to the provided parent view.

```swift
let BarcodePickView = BarcodePickView(parentView: view, context: context, BarcodePick: mode, settings: viewSettings)
let barcodePickView = BarcodePickView(frame: view.bounds, context: context, barcodePick: mode, settings: viewSettings)
```

Connect the `BarcodePickView` to the iOS view controller lifecycle. In particular, make sure to call `BarcodePickView.prepareSearching()` on your UIViewController’s [`viewWillAppear`](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621510-viewwillappear) method to make sure that start up time is optimal.
Expand Down Expand Up @@ -189,7 +189,7 @@ With everything configured, you can now start searching for items. This is done
```swift
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
BarcodePickView.start()
barcodePickView.start()
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/ios/matrixscan/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The advanced overlay combined with its listener offers an easy way of adding aug
First, create a new instance of `SDCBarcodeBatchAdvancedOverlay` and add it to your `SDCDataCaptureView`:

```swift
let overlay = BarcodeBatchAdvancedOverlay(barcodeBatch: barcodeBatch, for: captureView)
let overlay = BarcodeBatchAdvancedOverlay(barcodeBatch: barcodeBatch, view: captureView)
```

There are two ways to proceed from here:
Expand Down
7 changes: 6 additions & 1 deletion docs/sdks/ios/matrixscan/get-started-with-swift-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ class MatrixScanViewController: UIViewController {

extension MatrixScanViewController: BarcodeBatchBasicOverlayDelegate {
func barcodeBatchBasicOverlay(_ overlay: BarcodeBatchBasicOverlay,
didTapTrackedBarcode trackedBarcode: TrackedBarcode) {
brushFor trackedBarcode: TrackedBarcode) -> Brush? {
// Return a custom Brush based on the tracked barcode.
}

func barcodeBatchBasicOverlay(_ overlay: BarcodeBatchBasicOverlay,
didTap trackedBarcode: TrackedBarcode) {
// Handle barcode tap
// See the main Get Started guide
}
Expand Down
5 changes: 2 additions & 3 deletions docs/sdks/ios/matrixscan/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ When using the built-in camera as frame source, you will typically want to displ
To do that, add a [`SDCDataCaptureView`](https://docs.scandit.com/data-capture-sdk/ios/core/api/ui/data-capture-view.html#class-scandit.datacapture.core.ui.DataCaptureView) to your view hierarchy:

```swift
let captureView = DataCaptureView(for: context, frame: view.bounds)
captureView.dataCaptureContext = context
let captureView = DataCaptureView(context: context, frame: view.bounds)
captureView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(captureView)
```
Expand Down Expand Up @@ -141,7 +140,7 @@ override func viewDidLoad() {
Next, use this feedback in a `SDCBarcodeBatchListener`:

```swift
extension ScanningViewController: BarcodeBatchListener {
extension ViewController: BarcodeBatchListener {
func barcodeBatch(_ barcodeBatch: BarcodeBatch,
didUpdate session: BarcodeBatchSession,
frameData: FrameData) {
Expand Down
2 changes: 1 addition & 1 deletion docs/sdks/ios/sparkscan/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You can customize:
To emit an error, you have to implement a [SDCSparkScanFeedbackDelegate](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/spark-scan-feedback-delegate.html#interface-scandit.datacapture.barcode.spark.feedback.ISparkScanFeedbackDelegate) and set it to the [SparkScanView](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/ui/spark-scan-view.html#class-scandit.datacapture.barcode.spark.ui.SparkScanView):

```swift
sparkScanView.feedbackDelegate = self
sparkScanView.feedbackDelegate = self
```

In the [SDCSparkScanFeedbackDelegate.feedbackForBarcode](https://docs.scandit.com/data-capture-sdk/ios/barcode-capture/api/spark-scan-feedback-delegate.html#method-scandit.datacapture.barcode.spark.feedback.ISparkScanFeedbackDelegate.GetFeedbackForBarcode) you can then return an error or a success feedback:
Expand Down
Loading