在文本前列出分隔符的怪异行

List separators' weird lines before the text

好像想不通这个东西。在我的列表中,我在文本之前有这些白色(在黑暗模式下为黑色)线,我无法摆脱它们。有人告诉我,这意味着我编码有误。但它是什么?这是我的代码:

import SwiftUI

struct ContentView: View {

init(){
    UITableView.appearance().backgroundColor = .clear
}

var body: some View {
    
    List {
        Text("List Item 1").listRowBackground(Color("customColor"))
        Text("List Item 2").listRowBackground(Color("customColor"))
        Text("List Item 3").listRowBackground(Color("customColor"))
        Text("List Item 4").listRowBackground(Color("customColor"))
        Text("List Item 5").listRowBackground(Color("customColor"))
    }.background(Color("customColor"))
    }
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
    ContentView()
    }
}

然后在 appDelegates (didFinishLaunchingWithOptions) 中输入:

UITableView.appearance().separatorColor = .darkGray.

找到了几个关于列表背景颜色的主题,但在这些主题中似乎没有人关心这些烦人的线条。我该怎么做才能摆脱它们?

SwiftUI 2.0

无需更改 - 按原样工作

SwiftUI 1.0+

这是一个修复程序(使用 Xcode 11.4 / iOS 13.4 测试)

UITableViewCell.appearance().backgroundColor = .clear    // << add this one !!
UITableView.appearance().backgroundColor = .clear