Minimizing Body Re-evaluation
Reduce unnecessary view recomputation.
Body Is Recomputed Often
SwiftUI calls a view’s body whenever its inputs change. A heavy or over-connected body recomputes too frequently, hurting performance.
What Triggers Re-Evaluation
A body re-runs when any @State, @Binding, observed object, or environment value it reads changes—or when its parent passes new values.
struct Row: View {
let title: String // changes -> body re-runs
var body: some View { Text(title) }
}All lessons in this course
- Understanding View Identity
- Minimizing Body Re-evaluation
- Equatable Views and @State Scope
- Profiling with the SwiftUI Instrument