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
minAPI1.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.