igor
(Igor)
1
Hi, could you give an advice how to get rid of these horizontal insets(black) between a row and List border ?
List {
ForEach(0...5, id : \.self){ Text("\($0)").foregroundColor(.black) }
.listRowBackground(Color.white)
}
.listStyle(PlainListStyle())
.border(Color.yellow)
workaround with padding does not work
.padding(.horizontal, -8)
and playing with listRowInsets does not work also
.listRowInsets(EdgeInsets())
tera
2
not sure what's your intent here... if you just remove all color setting calls - "it just works" (in both dark and light modes).
tera
3
found this which explains it.
igor
(Igor)
4
thank you, but did not help
clearing the color does not get rid of space between list border and rows border
I guess the behaviour for macOS appeared in XCode 13
tera
5
indeed. and it's also a googleable (known) problem. perhaps this can work for you as a workaround (put the relevant OS version checks):
List {
ForEach(0...5, id : \.self){ Text("\($0)").foregroundColor(.black) }
.listRowBackground(Color.green)
}
.padding(.leading, -8) // ***
.padding(.trailing, -9) // ***
.listStyle(PlainListStyle())
}