@State: Local Mutable State in Views
Using @State to drive UI updates from private view state.
Welcome
`@State` is the simplest SwiftUI state management tool. It stores a mutable value inside a view and triggers a re-render whenever it changes.
@State Basics
```swift
struct Counter: View {
@State private var count = 0
var body: some View {
Button("Count: \(count)") { count += 1 }
}
}
```
All lessons in this course
- The View Protocol and Body Property
- @State: Local Mutable State in Views
- View Modifiers: Chaining and Custom Modifiers
- Previews and the Preview Provider