I'm following the steps in this article to improve SwiftUI performance with custom diffing. For now, I'm just returning true in ==:
struct MyView: View, Equatable {
@ObservedObject var model: DataModel
static func == (lhs: Self, rhs: Self) -> Bool {
return true
}
var body: some View { ... lots of stuff ... }
}
I'm using .equatable() to wrap MyView in EquatableView where it's used.
However in the SwiftUI instrument, I still see the entire view rebuilt whenever DataModel changes. And the debugger confirms that body is called. == is also called.
My understanding is that body should not be called if == returns true when diffing. Is that correct?
How can I further investigate this?