final func energyInsights(forDeviceID deviceID: String, using query: ElectricityInsightQuery, atVenue energyVenueID: UUID) async throws -> AsyncStream<ElectricityInsightRecord<Measurement<UnitEnergy>>>
Returns data that provides insight into electrical usage for a given device.
The system throws ``EnergyKitError/venueUnavailable`` if a person provides an invalid ``EnergyVenue`` identifier.
If another request is in progress, the system throws``EnergyKitError/inProgress``.
- Parameters:
- deviceID: The device identifier to return ``ElectricityInsightRecord``s for.
- query: The ``ElectricityInsightQuery`` to specify the results.
- energyVenueID: The ``EnergyVenue`` identifier to return ``ElectricityInsightRecord``s for.
- Returns: An `AsyncStream` of ``ElectricityInsightRecord``s containing UnitEnergy values for a given device.
final func runtimeInsights(forDeviceID deviceID: String, using query: ElectricityInsightQuery, atVenue energyVenueID: UUID) async throws -> AsyncStream<ElectricityInsightRecord<Duration>>
Returns records that provide insight into runtime of a given device.
The system throws ``EnergyKitError/venueUnavailable`` if a person provides an invalid ``EnergyVenue`` identifier.
If another request is in progress, the system throws``EnergyKitError/inProgress``.
- Parameters:
- deviceID: The device identifier to return ``ElectricityInsightRecord``s for.
- query: The ``ElectricityInsightQuery`` to specify the results.
- energyVenueID: The ``EnergyVenue`` identifier to return ``ElectricityInsightRecord``s for.
- Returns: An `AsyncStream` of ``ElectricityInsightRecord``s containing `Duration` values for a given device.
get · iOS 26.0+
unownedExecutor
TypeScript
get unownedExecutor(): SDKHandle
Swift declaration
nonisolated final var unownedExecutor: UnownedSerialExecutor { get }
Retrieve the executor for this actor as an optimized, unowned
reference.
This property must always evaluate to the same executor for a
given actor instance, and holding on to the actor must keep the
executor alive.
This property will be implicitly accessed when work needs to be
scheduled onto this actor. These accesses may be merged,
eliminated, and rearranged with other work, and they may even
be introduced when not strictly required. Visible side effects
are therefore strongly discouraged within this property.
- SeeAlso: ``SerialExecutor``
- SeeAlso: ``TaskExecutor``
get · iOS 26.0+
shared
TypeScript
static get shared(): ElectricityInsightService
Swift declaration
static let shared: ElectricityInsightService
A single, shared insight service object.
Use this object to interact with insight services in your app.