Contents

allDevices

Provides a snapshot of all the paired devices known to your app.

Declaration

static var allDevices: WAPairedDevice.DevicesSequence { get }

Mentioned in

Return Value

A new WAPairedDevice.DevicesSequence that returns WAPairedDevice.Devices elements holding a snapshot of the currently paired devices known to the app.

Discussion

This property gets an AsyncSequence and provides updates with a new WAPairedDevice.Devices snapshot when the set of paired devices known to your app changes. The sequence outputs an empty dictionary if there are no paired devices known to your app, or if a person removes all of your app’s paired devices.

You can select the set of Devices from this property using the following code snippet:

// Get a snapshot of all paired devices at the current moment.
guard let devices = try await WAPairedDevice.allDevices.current() { return }

// Get a snapshot of all paired devices at the current moment, and a new snapshot each time a device is added, changed, or removed.
for try await devices in WAPairedDevice.allDevices {
	// Process update.
}

See Also

Selecting from your app’s paired devices