ImmutableDeviceImplementation
@available(iOS 13.0.0, *)
public struct ImmutableDeviceImplementation<R> : ImmutableDevice where R : Device
Implementation of the ImmutableDevice protocol for managing devices that only support retrieval and deletion.
-
Initializes a new instance of
ImmutableDeviceImplementation.Declaration
Swift
public init(endpoint: String, deviceClient: DeviceClient)Parameters
endpointThe endpoint for retrieving and managing devices.
deviceClientThe
DeviceClientinstance used for performing network operations. -
get()AsynchronousRetrieves a list of devices from the server.
Throws
An error if the request fails or the response cannot be decoded.Declaration
Swift
public func get() async throws -> [R]Return Value
An array of devices of type
R. -
delete(_:Asynchronous) Deletes the specified device from the server.
Throws
An error if the request fails or the server response indicates failure.Declaration
Swift
public func delete(_ device: R) async throwsParameters
deviceThe device to delete.
View on GitHub