SettingsPagesProviding

Adopt to give your droplet's Settings page pages of its own (DroppyKit 1.13.0).

@MainActor protocol SettingsPagesProviding : SettingsPaneProviding

Your SettingsPaneProviding pane is the droplet's page. Put a DropletSettingsPageLink in it for each page, and build that page here when the user opens it. Root each page in DropletSettingsPage.

func makeSettingsPage(id: String, context: SettingsPaneContext) -> AnyView? {
    switch id {
    case "clocks": return AnyView(ClocksPage())
    default: return nil
    }
}

A page can link to further pages the same way. Return nil for an id you do not know; the host then goes back to your droplet's page.

  • Note: Maturity: Supported. Host support: mounted since Droppy 15.3. A host older than 1.13.0 never asks, and draws a link as a disabled row, so declare minAPI 1.13.0. See Host support.

Methods

makeSettingsPage(id:context:)

@MainActor func makeSettingsPage(id: String, context: SettingsPaneContext) -> AnyView?

Builds the page id names. Called each time the page opens, so return a fresh view and keep state in the droplet.

makeSettingsPageToolbar(id:context:)

@MainActor func makeSettingsPageToolbar(id: String, context: SettingsPaneContext) -> AnyView?

The controls of the page id names, for the trailing end of Droppy's Settings toolbar (DroppyKit 1.18.0).

What a page does as a whole (add an item to its list, its own on/off switch, a search over it, a menu of what can be done to it) belongs where Droppy's own pages keep theirs: in Liquid Glass pills at the right of the toolbar, on the page title's line. Built from DropletSettingsToolbarButton, DropletSettingsToolbarMenu, DropletSettingsToolbarSwitch and DropletSettingsToolbarSearchField in an HStack spaced pillSpacing, each one Droppy's own pill. Never draw such a bar on the page itself: it stands still while the page scrolls under it, where nothing else in Settings does.

Called whenever Droppy's toolbar redraws, so keep the state in an object the page and these controls both observe, never in the view you return. Keep it narrow: a text pill or two and a switch. A cluster the toolbar cannot hold beside the page title goes into AppKit's overflow menu whole. The default returns nil: no controls.

makeSettingsPageToolbar(id:context:)

@MainActor func makeSettingsPageToolbar(id: String, context: SettingsPaneContext) -> AnyView?

No controls in the toolbar for any page.