swift-cross-ui icon indicating copy to clipboard operation
swift-cross-ui copied to clipboard

ForEach doesn’t handle removals correctly

Open MiaKoring opened this issue 3 months ago • 1 comments

It always removes the last view node instead of removing the one that actually got removed. To fix this we need to know which node corresponds to which element. I’m not sure if reordering is a problem too at the moment. It may be.

For Identifiables/with a given Identifier it should be easy to remove the correct ones. Collections of non-Identifiables may need to be recomputed entirely.

I’m going to take a look at the correct-removal problem first. There may be a reordering issue too, which I will test after.

MiaKoring avatar Nov 05 '25 23:11 MiaKoring

Yeah we need to require that elements are Identifiable. It’s been on my todos for a little while. Otherwise there’s no way to assign the child views sensible identities.

stackotter avatar Nov 05 '25 23:11 stackotter