DropletLiquidMenuPicker
One value out of a short list, as the dropdown every Droppy pop-up is (DroppyKit 1.30.0): the chosen option's symbol and title with the round chevron badge, opening Droppy's Liquid menu with every option's symbol and the chosen one's checkmark at the trailing edge.
@MainActor struct DropletLiquidMenuPicker<ID> where ID : Hashable
settingsUnifiedPickerRow(title:subtitle:icon:iconColor:options:accessibilityLabel:groupPosition:isEnabled:isSelected:action:content:) is the same pop-up as a whole Settings row; use this one where the choice is not a row of its own: a toolbar, a droplet's panel, a popover, inside a DropletControlRow.
DropletLiquidMenuPicker("Units", selection: $units, options: [
SettingsPickerOption(id: Units.metric, title: "Metric", icon: "ruler.fill"),
SettingsPickerOption(id: Units.imperial, title: "Imperial", icon: "flag.fill"),
])Inside Droppy the menu is Droppy's own; in the harness and previews it is AppKit's pop-up menu. A disabled option is dimmed and refused.
Available from DroppyKit 1.30.0; it needs a Droppy that embeds 1.30.0.
Initializers
init(_:selection:options:attachment:isEnabled:)
@MainActor init(_ title: String, selection: Binding<ID>, options: [SettingsPickerOption<ID>], attachment: DropletLiquidMenuAttachment = .automatic, isEnabled: @escaping (ID) -> Bool = { _ in true })
Creates the dropdown.
- Parameters:
- title: What the choice is, for VoiceOver ("Units").
- selection: The chosen option's id.
- options: Every option with its SF Symbol, leading to trailing.
- attachment: The corner the menu grows from;
.automaticlets Droppy decide (away from the notch or the island on the shelf). - isEnabled: Per-option enablement.
Properties
body
@MainActor var body: some View { get }