MLKitBarcodeScanning Framework Reference

  • This documentation outlines globally available type definitions used for barcode scanning with ML Kit.

  • The types define various barcode formats like addresses, emails, phone numbers, and WiFi configurations.

  • Each type is a Swift struct that is bridged to Objective-C and conforms to protocols like Hashable, Equatable, and RawRepresentable.

  • A BarcodeScanningCallback type alias is provided for handling the results of barcode scanning, including potential errors.

Type Definitions

The following type definitions are available globally.

  • @enum BarcodeValueType Barcode’s value format. For example, TEXT, PRODUCT, URL, etc.

    Declaration

    Swift

    struct BarcodeValueType : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • @enum BarcodeAddressType Address type.

    Declaration

    Swift

    struct BarcodeAddressType : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • @enum BarcodeEmailType Email type for BarcodeEmail.

    Declaration

    Swift

    struct BarcodeEmailType : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • @enum BarcodePhoneType Phone type for BarcodePhone.

    Declaration

    Swift

    struct BarcodePhoneType : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • @enum BarcodeWiFiEncryptionType Wi-Fi encryption type for BarcodeWiFi.

    Declaration

    Swift

    struct BarcodeWiFiEncryptionType : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
  • A block containing an array of barcodes or nil if there’s an error.

    Declaration

    Swift

    typealias BarcodeScanningCallback = ([MLKBarcode]?, Error?) -> Void

    Parameters

    barcodes

    Array of barcodes scanned in the image or nil if there was an error.

    error

    The error or nil.