I have a demo App created to push the limits the VStack scrolling. I realize the VStack scrolling is not very performant and the often the vertical scrolling jerks while scrolling.
Here is a sample code of what i am trying to do.
List { // Top Vertical List
ForEach(sectionCount) { // List section count
VStack() {
Text("Header Title") // VStack Header title
ForEach(subSectionCount) // List subsection Count
VStack() {
Text("Sub Header title") // Sub header title
ScrollView() { // Horizontal scroll
HStack() {
ForEach(itemCount) { // item count
VStack() {
Image() // render imsge
Text("Item title") // title
Text("Item sub-title") // sub title.
}
}
}
}
}
}
}
}The purpose of the above code is to render a collection of items inside a collection. When i try to render the below data structure
Section<X, SubSection<Y, Items<Z>>, where X = 10, Y = 2, Z = 10. I see a lot of slowness and jerkiness while scrolling vertically in the list. I also see a memory spike while scrolling.
In the View Debugger window i noticed that Apple uses the UITableView to render the Vertical List but on the horizontal scale it uses the UIViews and i do see that all the views (cells) were rendered even if the views were outside the windows' bounds.
Please suggest the ways to optimize this, or may be Apple need to improve the rendering herarchy.