How to remove highlight on tap of List with SwiftUI?
List {
}.whatModifierToAddHere?
The selection manager documentation doesnt say anythi
A possible solution is to use a ZStack. And adjust insets to .zero. Change Color.red to your color. Your List:
ForEach(items) { item in
ZStack {
NavigationLink(destination: DetailView()) {
EmptyView()
}
ItemRowWrap(item: item)
.background(Color.red)
}
}
.listStyle(InsetListStyle())
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
Your ItemRowView:
struct ItemRowWrap: View {
let item: ListItem
var body: some View {
ItemRow(item: item)
.padding(EdgeInsets(top: 5, leading: 8, bottom: 5, trailing: 8))
}
}
You can adjust paddings as you need.