SwiftUI 2.0 如何更改表单部分的背景颜色

jwk*_*knz 2 swiftui swiftui-form

我正在尝试使用 SwiftUI 更改表单内部分的黑色区域。

从 iOS 14 中的 Swift 2.0 开始,一个表单用 a 填充显示这些,但使用背景和前景作为颜色,不会改变我需要改变的部分。

是否有修改器将黑色部分(在黑暗模式下)更改为任何其他颜色?

到目前为止,我有:

Form {
    Section(header: Text("User Details")) {
        Text("Name:").background(Color.red)
        Text("Email:").foregroundColor(Color.red)
    }
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

wor*_*dog 8

尝试这个:

Form {
    Section(header: Text("User Details")) {
         Text("Name:").background(Color.red)
         Text("Email:").foregroundColor(Color.red)
    }.listRowBackground(Color.green)
}
Run Code Online (Sandbox Code Playgroud)