Skip to main content
←API Reference ←NSDK ←NSDKScanningSession

saveCurrentScan


Declaration​

@MainActor func saveCurrentScan(timeout: Double = 10.0, pollingInterval: TimeInterval = 0.1) async throws -> NSDKScanningSession.SaveInfo

Summary​

Stops recording and asynchronously saves the recording to the configured path.
Calling this function will stop the active recording, but stop must still be called
afterward to completely shut down this session.

Returns​

Information about the saved scan, including it's id and file location.

Throws​

  • CancellationError if the Task running this function was cancelled.
  • TimeoutError if the function timed out before it could complete execution.
  • NSDKScanningSession.SaveError if there was an error specific to the save operation.
Notice

Important: Runs on the main actor, where the session is created and updated.

See also​

  • stop
  • configure(with:)

Parameters​

NameTypeSummary
timeoutDouble
The maximum duration in seconds to wait for the save operation
(default is 10 seconds).
pollingIntervalTimeInterval
The interval in seconds to wait between progress checks
(default is 0.1 seconds)