On macOS 26, the Label part of a LabeledContent control and the Section.header part of a Section do not seem to honour view modifiers like .controlSize(.small) when used inside a Form with .formStyle(.grouped). Is there a way to make them respect the control size?
Example:
Form {
Section("Details") {
LabeledContent("Company", value: "Apple")
}
}
.formStyle(.grouped)
.controlSize(.small) // This only effects 'Apple'
This produces a view where the value "Apple" is using a smaller font size but the label and the section header are not.
I've tried (I think) almost every variation I can think of in terms of creating a LabeledContent and applying .controlSize but all of them come up short. The Form appears to always override my view modifiers for the section heading and label.
Example 2:
Form {
Section {
LabeledContent {
Text("Company")
.controlSize(.small) // Has no effect.
} label: {
Text("Apple") // Correctly resized to .small.
}
} header: {
Text("Details")
.controlSize(.small) // Has no effect.
}
}
.formStyle(.grouped)
.controlSize(.small)
The best I've been able to come up with is a custom LabeledContentStyle that manually applies the layout and the styling, but that requires I explicitly "recreate" the macOS look-and-feel of left aligned labels and right aligned values by way of an HStack and Spacer.
Have I overlooked a way to style a Form or LabeledContent that would provide the results I'm looking for?