0Pricing
Swift Academy · Lesson

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

  1. Understanding View Identity
  2. Minimizing Body Re-evaluation
  3. Equatable Views and @State Scope
  4. Profiling with the SwiftUI Instrument
← Back to Swift Academy