@State: Views That Remember

Views have no memory

You know that a SwiftUI view is a struct, and that body describes what's on screen. Here's the catch: SwiftUI throws those structs away and rebuilds them constantly β€” every animation frame, every layout pass. A plain var count = 0 inside a view would reset to 0 each time. Your view needs memory that survives.

That's what @State is for. It's a property wrapper β€” an annotation you put in front of a property to give it extra behavior. @State tells SwiftUI: store this value for me, outside the struct, and keep it alive no matter how many times the view is rebuilt.

New term: re-render β€” SwiftUI calling body again to recompute what's on screen. You'll see the word a lot in this module.