ShelfWidgetCompositionProviding

Adopt to let Droppy own the widget's box (DroppyKit 1.23.0).

@MainActor protocol ShelfWidgetCompositionProviding : ShelfWidgetProviding

The droplet supplies the content of each composition; Droppy pads it by the clearance its clip needs, makes it fill the card, clips it, gives it the mount's font, ink and wash controls (a Button with no style of its own is the wash), blocks a second entrance transition and takes no clicks while the shelf springs. None of that can be forgotten, doubled or overridden, because the droplet is never asked for it.

extension WorldClockDroplet: ShelfWidgetCompositionProviding {
    public func makeWidgetContent(_ id: ShelfWidgetID, layout: ShelfWidgetLayout) -> AnyView {
        // Its traits declare `header: .standard`: the scaffold's
        // header row wraps beside the camera.
        AnyView(DropletWidgetComposition {
            ShelfWidgetScaffold("World Clock", systemImage: "globe") { clocks }
        } split: {
            ShelfWidgetScaffold("World Clock", systemImage: "globe") { firstClock }
        })
    }
}

The protocol's extension implements makeWidgetView(_:context:) with the same box, so the harness and any host draw the widget the same way. Droppy calls makeWidgetContent(_:layout:) itself and ignores a makeWidgetView of your own.

Available from DroppyKit 1.23.0; a droplet that adopts it declares minAPI 1.23.0.

Methods

makeWidgetContent(_:layout:)

@MainActor func makeWidgetContent(_ id: ShelfWidgetID, layout: ShelfWidgetLayout) -> AnyView

The widget's content for one mount. Content only: no padding, no root frame, no background, no transition, no hit-testing gate.

makeWidgetView(_:context:)

@MainActor func makeWidgetView(_ id: ShelfWidgetID, context: ShelfWidgetContext) -> AnyView

The content in the host's box, for a host that mounts the classic way (the harness).