the.bay.news

Observation optimizes away unnecessary callbacks for Equatable properties… sometimes

Swift Forums
Observation optimizes away unnecessary callbacks for Equatable properties… sometimes
It seems like changing a property in an @Observable class triggers observation callbacks, but that is optimized away the value does not actually change and it is of an Equatable type. This makes a lot of sense and is a nice optimization. But it seems like this optimization does not always work. Specifically, assigning the whole Equatable value does not trigger a callback (i.e. this uses the optimization): model.wrappedName = .init(value: sameNameAsBefore) …but assigning something inside the E...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.