Hi there!
I've been able to get the .listRowBackground()
modifier to work in SwiftUI (with iOS 15) but am experiencing a weird graphical issue where rows that start off screen do not have the correct background colour until they appear on screen then off again.
Not sure if there is a way to force all elements to render but as far as I can see I am using the modifier correctly.
Any help is greatly appreciated!
Anthony
Code:
var body: some View {
ZStack {
Color.theme.darkTheme
.edgesIgnoringSafeArea(.all)
VStack {
ForEach(Array(array.keys), id: \.self) { key in
List {
ForEach(systemFaults[key]!, id: \.self) { fault in
GenericItemView(label: "FAULT ID", item: "\(fault.faultID)")
GenericItemView(label: "IS ACTIVE", item: fault.isActive ? "TRUE" : "FALSE")
GenericItemView(label: "SET COUNT", item: "\(fault.setCount)")
GenericItemView(label: "LAST TIMESTAMP", item: "\(fault.timestampSeconds) secs")
}
.listRowBackground(Color.theme.darkerAccent)
}
Spacer()
}
}
}
}
Generic Item view is a simple HStack to display the text and associated value.
Screenshots
Initial Sheet being presented
Bottom Entries in the List Off Screen after Scrolling Up