Barcode Pick Async Mapper Product Provider

Defined in framework ScanditBarcodeCapture

BarcodePickAsyncMapperProductProvider
open class BarcodePickAsyncMapperProductProvider : NSObject, BarcodePickProductProvider

Added in version 6.19.0

A product provider that takes on construction a list of products to pick and a delegate

Usage example:

let products: Set<BarcodePickProduct> = [
  .init(identifier: "780846124122", quantityToPick: 2),
  .init(identifier: "750865926478", quantityToPick: 1),
  .init(identifier: "984579832123", quantityToPick: 4)
]
let productProvider = BarcodePickAsyncMapperProductProvider(products: products,
                                                          providerDelegate: self)

...

extension ViewController: BarcodePickAsyncMapperProductProviderDelegate {
  func mapItems(_ items: [String], completionHandler: @escaping ([BarcodePickProductProviderCallbackItem]) -> Void) {
    let result: [BarcodePickProductProviderCallbackItem] = myDb.findAndMapProductsForItemsData(items)
    completionHandler(result)
  }
}

Note

Use your preferred way to retrieve the initial list of products to pick and to handle the async retrieval of products from itemsData. In this snippet we’re using a hardcoded set of products and a fictitious myDb object for simplicity’s sake.

init
init(products: Set<BarcodePickProduct>, providerDelegate: any BarcodePickAsyncMapperProductProviderDelegate)

Added in version 6.19.0

Creates a new instance with the given set of BarcodePickProduct and callback to map items to products asynchronously.

updateProductList
open func updateProductList(_ products: Set<BarcodePickProduct>) -> Void

Added in version 6.25.6

Replaces the products database to the newly provided list. This will reset scanning and all the previous picking progress will be lost.