SwiftUI gives you several property wrappers for state, and the framework has evolved meaningfully since it launched — especially with iOS 17’s @Observable macro. This guide is an index to the property wrappers, navigation, and view-identity concepts that make up state management in SwiftUI, along with the Swift language fundamentals they build on.
Choosing a State Wrapper
Start here if you’re not sure which property wrapper a given piece of state needs:
- @State vs @StateObject vs @ObservedObject — the core distinction: does this view own the state, or receive it?
- @Binding — giving a child view read/write access to a value owned by its parent.
- @EnvironmentObject vs @Environment — sharing state across a whole view hierarchy without passing it through every layer.
Modernizing to @Observable (iOS 17+)
If your minimum deployment target is iOS 17 or later, Apple’s @Observable macro replaces ObservableObject/@Published and removes several of the older distinctions above:
- @Observable vs ObservableObject — what changes, what stays the same, and whether migrating existing code is worth it.
Why Views Update (or Don’t)
- SwiftUI View Identity — how SwiftUI decides whether to preserve or reset a view’s state, and why list rows sometimes lose state after a reorder.
Navigation
- NavigationStack — programmatic, path-driven navigation, and why it replaced NavigationView.
Persistence
- SwiftData vs Core Data — choosing a persistence layer for a SwiftUI app’s model data.
Swift Language Fundamentals
State management assumes you’re comfortable with the underlying Swift language. These cover the basics that come up constantly in SwiftUI code:
- The Singleton Pattern in Swift — a common pattern for shared resources like
UserDefaults.standardorURLSession.shared. - Creating a Class in Swift — the basics of class syntax, which underlies every
@ObservableandObservableObjectmodel. - UIContextualAction — swipe actions in UIKit-based table and collection views.
- iOS Development with Swift: Getting Started — a starting point if you’re new to iOS development.