MLKitBarcodeScanning Framework Reference

Barcode

class Barcode : NSObject

A barcode in an image.

  • The rectangle that holds the discovered barcode relative to the detected image in the view coordinate system.

    Declaration

    Swift

    var frame: CGRect { get }
  • A barcode value as it was encoded in the barcode. Structured values are not parsed, for example: ‘MEBKM:TITLE:Google;URL:https://www.google.com;;’. Does not include the supplemental value.

    It’s only available when the barcode is encoded in the UTF-8 format, and for non-UTF8 barcodes use rawData instead.

    Declaration

    Swift

    var rawValue: String? { get }
  • Raw data stored in barcode.

    Declaration

    Swift

    var rawData: Data? { get }
  • A barcode value in a user-friendly format. May omit some of the information encoded in the barcode. For example, in the case above the display value might be ‘https://www.google.com’. If valueType == .text, this field will be equal to rawValue. This value may be multiline, for example, when line breaks are encoded into the original TEXT barcode value. May include the supplement value.

    Declaration

    Swift

    var displayValue: String? { get }
  • A barcode format; for example, EAN_13. Note that if the format is not in the list, .unknown would be returned.

    Declaration

    Swift

    var format: BarcodeFormat { get }
  • The four corner points of the barcode, in clockwise order starting with the top left relative to the detected image in the view coordinate system. These are CGPoints wrapped in NSValues. Due to the possible perspective distortions, this is not necessarily a rectangle.

    Declaration

    Swift

    var cornerPoints: [NSValue]? { get }
  • A type of the barcode value. For example, TEXT, PRODUCT, URL, etc. Note that if the type is not in the list, .unknown would be returned.

    Declaration

    Swift

    var valueType: BarcodeValueType { get }
  • An email message from a MAILTO: or similar QR Code type. This property is only set if valueType is .email.

    Declaration

    Swift

    var email: BarcodeEmail? { get }
  • A phone number from a ‘TEL:’ or similar QR Code type. This property is only set if valueType is .phone.

    Declaration

    Swift

    var phone: BarcodePhone? { get }
  • sms

    An SMS message from an ‘SMS:’ or similar QR Code type. This property is only set if valueType is .sms.

    Declaration

    Swift

    var sms: BarcodeSMS? { get }
  • url

    A URL and title from a ‘MEBKM:’ or similar QR Code type. This property is only set if valueType is .url.

    Declaration

    Swift

    var url: BarcodeURLBookmark? { get }
  • Wi-Fi network parameters from a ‘WIFI:’ or similar QR Code type. This property is only set if valueType is .wifi.

    Declaration

    Swift

    var wifi: BarcodeWifi? { get }
  • GPS coordinates from a GEO: or similar QR Code type. This property is only set if valueType is .geo.

    Declaration

    Swift

    var geoPoint: BarcodeGeoPoint? { get }
  • A person’s or organization’s business card. For example a VCARD. This property is only set if valueType is .contactInfo.

    Declaration

    Swift

    var contactInfo: BarcodeContactInfo? { get }
  • A calendar event extracted from a QR Code. This property is only set if valueType is .calendarEvent.

    Declaration

    Swift

    var calendarEvent: BarcodeCalendarEvent? { get }
  • A driver’s license or ID card. This property is only set if valueType is .driverLicense.

    Declaration

    Swift

    var driverLicense: BarcodeDriverLicense? { get }
  • Unavailable.