I'm not entirely sure if this API only shows which fields have changed (e.g., change.updatedAttributes), or if it also provides the updated values for those fields. Ultimately, my goal is to allow users to click in the app to view how a model has mutated over time, and I was wondering if this feature could facilitate that.
Does SwiftData History API (introduced in WWD24) allows to also monitor value changes?
For an update on the store, SwiftData History API tells you what fields were updated, as you have mentioned. The field values after the update are the current values in the store. The values before the update are lost.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.
Undo is a completely different feature – It caches the data and operations in a undo stack. Not like the history, the undo stack is not persisted; it stays in memory and is cleared when the app is relaunched
Best,
——
Ziqiao Chen
Worldwide Developer Relations.