I'm new to SwiftUI and trying to create a UI component like UITableView. I'm using List and there's a couple of things I'd like to customize.
- There's a margin on the left. I managed to gap the margin for components inside the item but not the bottom border.
- I'd like to change the color of the List item's bottom border.
Here is how my code looks:
List {
ForEach(someArray) { _ in
Text("Item")
.listRowInsets(EdgeInsets()) // To gap the left margin
}
}
To be specific about the List item's bottom border, I will attach this image.
The line pointed by the red arrow is the List item's bottom border I mean. Not just the last border but each item's border.
I would appreciate any insight. Thank you!
SwiftUI is still missing some features known from UIKit. This will certainly change in the course of time, but for now I would recommend a slightly different approach. You could achieve the desired result by using a
ScrollView
in combination with aLazyVStack
(iOS14)