DropletShelfService

Opens and closes Droppy's shelf, and reveals this droplet's widgets in it.

@MainActor protocol DropletShelfService : AnyObject

Requires the shelf-read capability to observe and shelf-write to act.

Properties

didChange

@MainActor var didChange: AnyPublisher<Void, Never> { get }

Fires when the shelf opens, closes, or swaps widgets.

isExpanded

@MainActor var isExpanded: Bool { get }

Whether the shelf is currently expanded.

soloWidgetID

@MainActor var soloWidgetID: ShelfWidgetID? { get }

The widget currently shown alone on the shelf, if any. nil while the shelf is closed or showing a paired row.

Methods

close()

@MainActor func close()

Closes the shelf if this droplet opened it.

invalidateLayout(for:)

@MainActor func invalidateLayout(for widgetID: ShelfWidgetID)

Asks the host to re-measure a widget whose content changed size. Call this after your model changes the size your view reports, not on every keystroke.

open(revealing:)

@discardableResult @MainActor func open(revealing widgetID: ShelfWidgetID?) -> Bool

Opens the shelf, optionally showing one of this droplet's widgets alone. Returns false when the host refused.