SwiftUI 2.0 how to change the background color of a form section

Viewed 1815

I am trying to changing the black area of a section inside of a form using SwiftUI.

Since Swift 2.0 in iOS 14, a form shows these with a of padding, but using background and foreground for the colors, does not change the part I need to change.

Is there a modifier that changes the black part (in dark mode) to any other colour?

So far I have:

Form {
    Section(header: Text("User Details")) {
        Text("Name:").background(Color.red)
        Text("Email:").foregroundColor(Color.red)
    }
}

enter image description here

1 Answers

try this:

Form {
    Section(header: Text("User Details")) {
         Text("Name:").background(Color.red)
         Text("Email:").foregroundColor(Color.red)
    }.listRowBackground(Color.green)
}
Related