Skip to content
SwiftMind
iOShigh impactReleased 2023-09-18

iOS 17 — the Observation framework

@Observable replaces ObservableObject for most SwiftUI state, and changes which views actually redraw.

new

@Observable tracks property access instead of object change

With ObservableObject, any @Published change redrew every view observing the object. @Observable tracks which properties a view's body actually read, so a view only redraws when something it genuinely uses changes. This usually removes a whole class of over-rendering without any work beyond adopting the macro.

What to do

Replace ObservableObject + @Published with @Observable, and @StateObject/@ObservedObject with @State or a plain property.

deprecated

ObservableObject is now the legacy path

Still supported, but new code should not reach for it. It remains necessary only when deploying below iOS 17.