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.

  • Note: Maturity: Stable. This is how Droppy finds your provider. Requires the expanded-surface capability. See Host support.

Properties

expandedSurfaceProvider

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

The provider, or nil when the droplet currently offers no expanded surface. Read each time the droplet presents a surface, on every render pass of a presented one, and after each state change the droplet broadcasts while one is up (see ExpandedSurfaceProviding). Taking it away does not dismiss a presented surface; dismiss it first.