ScannerError

public struct ScannerError : Error, Equatable

Represents errors that can occur during scanner operations.

  • A unique code identifying the type of error (e.g., “permission_denied”, “bluetooth_off”).

    Declaration

    Swift

    public let code: String
  • A readable message describing the error and potentially offering troubleshooting advice.

    Declaration

    Swift

    public let message: String
  • Initializes a new scanner error.

    Declaration

    Swift

    public init(code: String, message: String)

    Parameters

    code

    The unique error code.

    message

    The descriptive error message.

  • A localized description of the error, formatted as “[code] message”.

    Declaration

    Swift

    public var localizedDescription: String { get }
  • Error indicating the scanner is not available on the current device or under current conditions (e.g., SDK not imported, hardware not present).

    Declaration

    Swift

    public static let notAvailable: ScannerError
  • Error indicating that necessary permissions (e.g., camera for VisionKit, Bluetooth for hardware scanners) were denied by the user or are restricted by system policy.

    Declaration

    Swift

    public static let permissionDenied: ScannerError
  • Error indicating that the scanner failed to initialize, possibly due to an SDK issue or hardware malfunction.

    Declaration

    Swift

    public static let initializationFailed: ScannerError
  • Error indicating the operation is not supported on the current device.

    Declaration

    Swift

    public static let notSupported: ScannerError