问题
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