Hi everyone,
I'm currently working on a project that involves a card-swiping feature in SwiftUI. I'm facing an intermittent issue where, occasionally, removing an element from the array does not trigger the expected SwiftUI redraw. Consequently, conditions like if array.isEmpty
are not being activated as they should.
To delve deeper, I tested with Project 17 (downloaded from Flashzilla), which employs similar logic for handling arrays and card swiping. Interestingly, I was able to reproduce the same issue in this project. After clearing the stack of cards repeatedly, there comes a point where the screen remains empty, and the cards.isEmpty condition does not get triggered, even though the array is indeed empty.
This issue doesn't happen consistently but is noticeable with persistent interaction. It seems like SwiftUI is not detecting changes in the array's count or its isEmpty state under certain circumstances (which i cannot identify).
Has anyone else encountered similar issues with SwiftUI not detecting changes in an array's count or the isEmpty state? Any insights or solutions would be greatly appreciated.
Thank you in advance for your help!