How can I change the default gray background color of a GroupBox view in SwiftUI?
I tried adding a background modifier, but this just changes the white background underneath the box (see screenshot).
GroupBox(label: Text("Label"), content: {
Text("Content")
})
.background(Color.blue)
The answer to this question has changed in recent (iOS16) versions. You can now use backgroundStyle(_:)
. The documentation can be found here
GroupBox(label: Text("Label"), content: {
Text("Content")
})
.backgroundStyle(Color.blue)