dkk / WrappingHStack

A SwiftUI HStack with the ability to wrap contained elements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimization needed

dkk opened this issue · comments

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: scottostler@4c74430

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