I'm trying to remove the "row" separators (known as dividers in SwiftUI) from a List
in SwiftUI.
I went through the List
documentation, but I haven't been able to find a modifier for that.
Any help would be appreciated.
listswiftswiftui
I'm trying to remove the "row" separators (known as dividers in SwiftUI) from a List
in SwiftUI.
I went through the List
documentation, but I haven't been able to find a modifier for that.
Any help would be appreciated.
Best Answer
iOS 15:
This year Apple introduced a new modifier
.listRowSeparator
that can be used to style the separators. you can pass.hidden
to hide it:iOS 14
Apple introduced
LazyVStack
In iOS 14. you may consider using it instead of list for this:Keep in mind that
LazyVStack
is lazy and doesn't render all rows all the time. So they are very performant and suggested by Apple itself in WWDC 2020.iOS 13
There is a
UITableView
behind SwiftUI'sList
for iOS. So to removeExtra separators (below the list):
you need a
tableFooterView
and to removeAll separators (including the actual ones):
you need
separatorStyle
to be.none