This works on iOS13 and below

onAppear(){
    UITableView().appearance().separatorStyle = .none        
} 
Copy the code

IOS14 can use the method, custom Modifier (semi-finished)

struct HideRowSeparatorModifier: ViewModifier {
  static let defaultListRowHeight: CGFloat = 44
  var insets: EdgeInsets
  var background: Color
  init(insets: EdgeInsets.background: Color) {
    self.insets = insets
    var alpha: CGFloat = 0
    UIColor(background).getWhite(nil, alpha: &alpha)
    assert(alpha = = 1."Setting background to a non-opaque color will result in separators remaining visible.")
    self.background = background
  }
  func body(content: Content) -> some View {
    content
      .padding(insets)
      .frame(
        minWidth: 0, maxWidth: .infinity,
        minHeight: Self.defaultListRowHeight,
        alignment: .leading
      )
      .listRowInsets(EdgeInsets())
      .background(background)
  }
}
extension EdgeInsets {
  static let defaultListRowInsets = Self(top: 0, leading: 0, bottom: 0, trailing: 0)}Copy the code
extension View {
  func hideRowSeparator(
    insets: EdgeInsets = .defaultListRowInsets,
    background: Color = .white
  ) -> some View {
    modifier(HideRowSeparatorModifier(
      insets: insets,
      background: background
    ))
  }
}
Copy the code
 List{
    ForEach(0..<15){ index in
        Text("Test")
             .hideRowSeparator()
    }
}
Copy the code

IOS14 might be useful

List {
   .
}.listStyle(SidebarListStyle())
Copy the code

iOS15

List {
    ForEach(items, id:\.self) { 
        Text("Row \ [$0)")
            .listRowSeparator(.hidden)
    }
}
Copy the code

SwiftUI text data is too little, who can have a better way, online for guidance