Roomio
Entry point for the Roomio SDK.
enum Roomio
Overview
Configure the SDK once at launch, check the device can scan, then start a scan.
Roomio.configure(publishableKey: "roomio_pub_live_…")
guard Roomio.isSupported() == .supported else { return }
let session = try Roomio.startScan()
configure(publishableKey:)
Configure the SDK with your publishable key. Call once, before any other SDK method.
static func configure(publishableKey: String)
Discussion
The publishable key identifies your organisation. It is safe to include in your app. The SDK uses it to fetch its configuration from Roomio in the background from time to time. The first scan after your app is installed or updated needs that to have happened once; after that, scanning works offline. It also sends Roomio reports of how scans went, with the errors and crashes behind them, when the SDK starts and after each scan. Nothing in them identifies your users.
exportDiagnostics(scanId:)
Package the SDK’s recent diagnostics into an encrypted file to send to Roomio support, including scans that crashed or never exported. Covers recent scans, or only scanId when given, and the calls your app made into the SDK. Only Roomio can read the file.
static func exportDiagnostics(scanId: String? = nil) async throws -> URL
Parameters
scanId
The scan to include, from scanId; nil includes every kept scan.
Throws: RoomioError with exportFailed if the diagnostics cannot be packaged.
flush()
Send any waiting reports now, in the background. The SDK already sends them when it starts and after each scan, so you rarely need this. Does nothing while a scan is recording.
static func flush()
isSupported()
Whether this device can scan. Call before offering a scan, and hide the option on devices that return RoomioSupport.unsupported.
static func isSupported() -> RoomioSupport
setDiagnosticsDelegate(_:minimumLevel:)
Receive the SDK’s diagnostic messages at minimumLevel and above, for example to forward to your own logging. Pass nil to stop. The SDK holds the delegate weakly. Messages arrive on the main thread. Errors also go to the console, with or without a delegate.
static func setDiagnosticsDelegate(_ delegate: RoomioDiagnosticsDelegate?, minimumLevel: RoomioDiagnosticLevel = .info)
startScan(config:)
Create a session for a new scan.
static func startScan(config: RoomioScanConfig = RoomioScanConfig()) throws -> RoomioScanSession
Discussion
The returned session is not recording yet: present a RoomioScanView and call start(). Your app’s Info.plist must include NSCameraUsageDescription.
The SDK asks for camera access when the camera starts: when the onboarding ends, or straight away if there is none. It doesn’t ask if your app already has access, so you can ask first to give your own explanation. Once access is declined, the view asks the user to allow it in Settings.
Throws: RoomioError with notConfigured if configure(publishableKey:) has not been called, deviceNotSupported if this device cannot scan, connectionRequired if the app hasn’t been online since it was installed or updated, publishableKeyRejected if Roomio didn’t accept the publishable key, or sdkUpdateRequired if this SDK version is no longer supported.
version
The version of the Roomio SDK.
static var version: String { get }