SettingsUnifiedSegmentedRow
One value out of a short list, as the native pop-up button a System Settings row carries: the current choice with the up/down chevrons, a checkmarked menu of every option, keyboard and VoiceOver behaviour courtesy of AppKit.
@MainActor struct SettingsUnifiedSegmentedRow<Option, Content> where Option : Hashable, Content : View
The cornerRadius, groupPosition and segmentHeight parameters are kept so every already compiled droplet keeps building and running; the pop-up owns its own chrome. Exactly one option is selected at a time.
Initializers
init(options:cornerRadius:groupPosition:segmentHeight:accessibilityLabel:isEnabled:isSelected:action:content:)
@MainActor init(options: [Option], cornerRadius: CGFloat = DroppyRadius.large, groupPosition: SettingsGroupPosition, segmentHeight: CGFloat = 34, accessibilityLabel: String, isEnabled: @escaping (Option) -> Bool = { _ in true }, isSelected: @escaping (Option) -> Bool, action: @escaping (Option) -> Void, @ViewBuilder content: @escaping (Option, Bool) -> Content)
Creates a native selection row.
- Parameters:
- options: The options, leading to trailing.
- cornerRadius: Retained for compatibility; macOS owns the pop-up chrome.
- groupPosition: Retained for compatibility with existing panes.
- segmentHeight: Retained for compatibility; the pop-up sizes itself.
- accessibilityLabel: Label for the whole control.
- isEnabled: Per-option enablement.
- isSelected: Per-option selection state.
- action: Selection handler.
- content: Option label builder, receiving the option and its selected state. Use
settingsUnifiedSegmentLabel(icon:title:isSelected:isEnabled:).
Properties
body
@MainActor var body: some View { get }