Understanding View Identity
Control how SwiftUI diffs and reuses views.
Identity Drives SwiftUI
SwiftUI tracks each view by its identity to decide whether to update an existing view or create a new one.
Getting identity right is the single biggest lever for correctness and performance.
Two Kinds of Identity
SwiftUI uses two forms: structural identity (a view’s position in the view tree) and explicit identity (an id you assign).
All lessons in this course
- Understanding View Identity
- Minimizing Body Re-evaluation
- Equatable Views and @State Scope
- Profiling with the SwiftUI Instrument