current()
Fetches a one-time snapshot of all paired devices that are currently known and accessible to your app.
Declaration
func current() async throws -> WAPairedDevice.DevicesSequence.Element?Return Value
A single WAPairedDevice.Devices element holding a snapshot of the currently paired devices known to the app, or nil if the sequence has no more values.
Discussion
The WAPairedDevice.Devices dictionary holds a snapshot of the currently paired devices that are known and accessible to your app. This method returns an empty dictionary if there are no paired devices known to your app. The following code is an example of how to use current() to return the first Devices snapshot in the sequence:
guard let devices = try await WAPairedDevice.allDevices.current() { return }Don’t use this method if you need to monitor for changes to the paired device list, or change app behavior in response to such changes. Instead, use
for try await devices in WAPairedDevice.allDevices {
// Process the devices.
}