WrappingHStack
WrappingHStack copied to clipboard
Optimization needed
When drawing many items, for example with something like:
WrappingHStack(1...50) {
Text("Item: \($0)")
}
it takes way too long to draw.
@dkk one optimization I found helpful was to store the result of InternalWrappingHStack.firstItemOfEachLane
so it's only computed once – that made the difference in being able to use this for an interactive UI with about 20 items
if you'd like I can open a PR, it's a very small change: https://github.com/scottostler/WrappingHStack/commit/4c7443014fffff09279a29bd7b351ced8ad0aa42
thanks for providing this library btw, it was just what I needed for a collection of pill buttons
Thanks a lot. Yes, please open that PR. I'm on holidays right now, but I'll try it out as soon as I'm back.
Included in release 2.1.2. I'm leaving this issue open since I still would like to write performance tests & maybe take a look if I can improve WrappingHSTack some more.
Fixed at version 2.2.8