JWAutumn / ACarousel

A carousel view for SwiftUI | SwiftUI 旋转木马效果
MIT License
381 stars 78 forks source link

what should the index be when there are no items? #22

Open nimrodbens opened 1 year ago

nimrodbens commented 1 year ago

i’m having a crash in this library and i can’t seem to pinpoint it.

i have dynamic data so it can also have zero items.

in this case what seems to be the only working thing is to set the index to -1, but i’m not sure if it’s the right way.

#7  0x0000000100861948 in closure #1 in closure #1 in ACarousel.generateContent(proxy:) ()

this is what i can get.

Isuru-Nanayakkara commented 8 months ago

I faced the same issue. I'm fetching some items from an API call so at the time of the initial launch, the item count is 0. So it crashes with the error The index should be less than the count of data message.