On macOS 26.3, Xcode 26.3, why does a labelStyle of titleAndIcon not show both the title and the icon of a label?
The label styles iconOnly and titleOnly behave as expected.
Picker("Label Demo", selection: $selectedItem) {
Label {
Text("File")
} icon: {
Image(systemName: "doc")
}
Label {
Text("Folder")
} icon: {
Image(systemName: "folder")
}
}
.labelStyle(.titleAndIcon)
.pickerStyle(.segmented)
Note that there is no icon shown. Placing the .labelStyle modifier in different places has no effect.
The icon is correctly shown when the labelStyle is set to .iconOnly.
An NSSegmentedControl created with AppKit and presented in an NSViewRepresentable does correctly show titles and icons if configured appropriately.
Tested on:
- macOS 26.3 (25D125)
- Xcode 26.3 (17C519)
- A brand new SwiftUI "macOS App" project.