I have multiple UIStackViews
in a scroll view. As the view is loaded each stack view, say 6, is populated with ~8 views in each. This means at a table view cell tap, 48 views will be initialized and equally added to one of 6 stack views. As you can imagine there is a 0.5 - 1 second lag when tapping the table view cell to load the stack view. It definitely feels like a slow down and doesn't feel right in an iOS app.
Simplified my code looks like this:
for (index, stackView) in stackViews.enumerated() {
for view in views[index] {
stackView.addArrangedSubview(view)
}
}
I have considered these options:
- Adding/removing the stack views when they come in and out of view, although on an iPad all stack views can be seen anyway.
- Multi-threading, although I am not sure if this is possible as all UI code needs to be ran on the main thread.
- Simply using
draw
as the views within the stack view are all mostly similar in appearance.
Are any of these worth committing to? Are there any other options I have not considered?