SwiftUI redraws when state changes. @State holds a view's private data; @Binding lets a child view read and write a parent's state.
@State
struct CounterView: View {
@State private var count = 0
var body: some View {
Button("Count: \(count)") { count += 1 }
}
}
@Binding
struct ToggleRow: View {
@Binding var isOn: Bool
var body: some View { Toggle("Enabled", isOn: $isOn) }
}
// parent passes $someState to it
The \$ prefix creates a binding to a state value.
Common mistake: @State is for simple, view-local data. For shared/complex data use ObservableObject (next topics).
Summary
@State drives a view's own UI; @Binding shares mutable state with child views via the \$ prefix.