How to remove List Separator lines in SwiftUI 2.0 in iOS 14

只谈情不闲聊 提交于 2020-07-18 18:04:23

问题


So the question is pretty simple and it's in the title. I want to remove the line separator in SwiftUI iOS 14. Previously, I was using UITableView().appearance().separatorStyle = .none and that used to do the job in iOS 13. Now however, it doesn't work. Any update or idea on how to make it work. Thanks:)


回答1:


Here is a demo of possible solution. Tested with Xcode 12b.

List {
    ForEach(0..<3) { _ in
        VStack {
            Text("Hello, World!").padding(.leading)
        }
        .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
        .listRowInsets(EdgeInsets())
        .background(Color.white)
    }
}



回答2:


The above answer work for me, you have to set only below both function:

.listRowInsets(EdgeInsets())

.background(Color.white)



来源:https://stackoverflow.com/questions/62597493/how-to-remove-list-separator-lines-in-swiftui-2-0-in-ios-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!