you have no idea how often I have to bash it into claude’s thick little skull to not write this sucker
@samhenrigold I haven’t written anything too complex in SwiftUI yet (mostly just stuff like little modals and collection view cells). If you have a moment, why is this bad and what should be used instead?

@johnwells if/else in a ViewBuilder produces a _ConditionalContent<V, Self> which are two different view types on each branch. When condition changes, SUI sees a completely different view identity, so it destroys the old view and its state, creates a new one from scratch, and you lose all implicit animations and transitions because it thinks it’s animating between two totally unrelated views.

The suggested route is to apply the modifier directly with a ternary.
.foregroundStyle(isActive ? .tint : .primary) or whatever

@samhenrigold Thanks for the explanation!