Is there a way to change background color of the section in list? It always has grey color no matter what I try.
List Section Background Color
I'm guessing that it's a bug. I would have thought that one could have set the background view to yellow, for example, using
.background(Color.yellow)
You can do like this
struct CustomeHeader: View {
let name: String
let color: Color
var body: some View {
VStack {
Spacer()
HStack {
Text(name)
Spacer()
}
Spacer()
}
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
.background(color)
}
}
Try that with a List instead of just a VStack.