DeviceCollector
public protocol DeviceCollector
Protocol for device collectors that gather specific types of device information.
Device collectors are responsible for collecting specific categories of device data such as platform information, hardware specifications, network status, etc. Each collector returns a specific data type and has a unique key identifier.
Example usage:
let platformCollector = PlatformCollector()
let platformInfo = try await platformCollector.collect()
print("Collector key: \(platformCollector.key)")
-
The type of data this collector returns
Declaration
Swift
associatedtype DataType : Decodable, Encodable -
Unique identifier for this collector type
Declaration
Swift
var key: String { get } -
collect()AsynchronousCollects device information of the specified type
Throws
Any errors that occur during data collectionDeclaration
Swift
func collect() async throws -> DataType?Return Value
The collected data, or nil if collection fails
View on GitHub