ExpandedSurfaceHosting

Adopt to take the expanded shelf over with your own content.

@MainActor protocol ExpandedSurfaceHosting : Droplet

This is the discovery point: the host casts a loaded droplet to ExpandedSurfaceHosting and reads expandedSurfaceProvider.

public final class DictationDroplet: Droplet, ExpandedSurfaceHosting {
    public static let id: DropletID = "dictation"
    private var session: DictationSession?

    public func activate(host: DropletHost) throws { session = DictationSession(host: host) }
    public func deactivate() { session = nil }

    public var expandedSurfaceProvider: (any ExpandedSurfaceProviding)? { session }
}

A droplet that would rather implement the provider on itself returns self.

Properties

expandedSurfaceProvider

@MainActor var expandedSurfaceProvider: (any ExpandedSurfaceProviding)? { get }

The provider, or nil when the droplet currently offers no expanded surface. Re-read after every state-change broadcast.