SwiftUI has these pesky errors that show up when the backing graph is put into a sort of loop. Something along the lines of “Bounds preference updated multiple times per frame”, truly unhelpful and vague.
They’re presence in the console usually means some extra view updates are happening. SwiftUI likes to be stable, updates causing updates is bad. Having view state (like row heights) determine view visibility means update cascade is a real possibility.
Adding estimated views to the hierarchy was causing them to be removed in the same layout pass once they’re actual size was determined. So my solution is to only add to the estimation so that known sizes cannot cause removal from the view graph.
Selectively showing views is actually quite simple after that. Since the underlying layout knows each view position knows which are visible, their identity is maintained by a ForEach which is passed a visible subsequence of views and positions.
Okay, anyone remember that scene in Edge of Tomorrow where they talk with General but they don't quite know how to proceed because they've never managed to get that far with him before...