Member-only story
The “Observation Is More Efficient” Myth
Observation is more efficient. Everyone knows this. Don’t they?
Ever since Apple introduced the new @Observable
macro with Swift 5.9 and iOS 17, there’s been a steady stream of posts claiming that ObservableObject
is obsolete. Outdated. Inefficient.
That, like AnyView, it should be completely purged from your project and totally banished from the realm.
You’ve probably heard the sales pitch.
Observable is more efficient. It tracks which properties are used in the view and only re-renders when those properties change. Meanwhile, ObservableObject just blasts out objectWillChange events and that causes everything to update. Don’t use it anymore.
But like a lot of the “common knowledge” parroted about in iOS circles, it contains a grain of truth… buried in a silo full of oversimplification and overgeneralization.
Let’s dig in.
Evaluation Is Not Rendering
The key thing to understand is that ObservableObject
and @Observable
both cause SwiftUI to re-evaluate view bodies when observed state changes.
If a view accesses a property on the view model and that property changes, then the body is re-evaluated. This is true in…