0Pricing
Swift Academy · Lesson

@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

  1. The View Protocol and Body Property
  2. @State: Local Mutable State in Views
  3. View Modifiers: Chaining and Custom Modifiers
  4. Previews and the Preview Provider
← Back to Swift Academy