In SwiftUI, UITableView
is replaced with List
.
Is there a way to alternate the background colors of the list's cells/rows?
I would like to implement something like this:
if (indexPath.row % 2 == 0) {
aCell.backgroundColor = UIColor(red: 0, green: 1, blue: 0, alpha: 1.0)
}
See article https://medium.com/@ronm333/improving-the-appearance-of-ios-tableviews-9effb7184efb for a good example.
ForEach(_:content:)
should only be used for constant data." – Langford