This sample code exhibits two issues:
struct ContentView: View
{
@State private var myColor = Color.red
var body: some View {
VStack() {
List() {
Text("Object")
Text("Object")
Text("Object")
.listRowSeparatorTint(myColor)
Text("Object")
}
Button(action:{myColor = Color.green})
{Text("Change color")}
}
.foregroundColor(myColor)
}
}
- the row separator isn't redraws when the @State property change
- listRowSeparatorTint apply to two lines
The first point is really disappointing. Is there anyone which know if this is a bug or there is a more correct way to use listRowSeparatorTint with changing parameter?
Your first point does look like a bug. You should raise it in the usual way at https://feedbackassistant.apple.com/ then post the FB number here.
To your second point, it looks like it's applying it to two rows, but it isn't. You need to tell it which edges to apply it to. If you don't it applies to all edges by default, so top and bottom.
If you change that line to .listRowSeparatorTint(myColor, edges: .top)
you'll see it only applies to the very centre line, i.e.: