DropletInstallStateService

Reports what the user has switched on, so a droplet can avoid doing work for a widget nobody is showing.

@MainActor protocol DropletInstallStateService : AnyObject

Subscribe to statePublisher rather than reading state once in activate(host:): the state can settle just after activation, once Droppy knows which of the widgets you declare are on the shelf.

Properties

state

@MainActor var state: DropletInstallState { get }

The current state.

statePublisher

@MainActor var statePublisher: AnyPublisher<DropletInstallState, Never> { get }

Sends the current state when you subscribe, then every change to state, on the main actor. Droppy after 16.0.1 sends a change when the user places or removes one of your widgets and when the droplet is about to be switched off; it never sends a value equal to the last. Droppy 16.0.1 and earlier never send a change.