Ok thanks for the feedback. I get the optimization angle, but it seems a little heavy-handed.
That said, I probably wouldn’t have brought up the question at all except that the actual run-time effect wasn’t totally orthogonal to my expectations. Inefficient? Yes. Tossing out the dupes? Sure. But randomly drawing one of the entities in the wrong place… perplexing.
To be fair, the error did say it would cause unpredictable results so I guess I have to accept it!
🤪
Just out of curiosity, does anyone have any insight as to why the #SwiftUI implementation of ForEach requires unique/hashable entities?
I get that it's more efficient to not do the same operation on multiple identical entities, but I had a strange bug where I wanted to draw multiple paths to the screen, and having a matched set caused all paths but the first to be misrendered or not rendered at all.
I fixed the bug, but I'm curious about the design choice. Any perspectives out there?