Post

Replies

Boosts

Views

Activity

SwiftData Autosave and Last Updated Timestamp
I have in my model a date created attribute and a date last updated attribute. When adding a new item, I set both to the current timestamp. However, on an update I would like to be able to have the autosave option auto-update the last updated date automatically. Turning off autosave and doing it manually is challenging to get right. Does anyone know of a solution to this such as extending ModelContext? It seems like last updated date would be a common model requirement.
1
0
1.2k
Aug ’23