Post

Replies

Boosts

Views

Activity

Comment on Changes to SwiftData SubModels do not update the UI
Your code is non-standard because you embed a ModelObject (ItemDetail) inside another ModelObject (Item) without defining a relationship. Don’t do that. You need to either make ItemDetail a plain struct, or make it a @Model with a relationship defined between the two. I’ve never seen any Swift Data code that does what you do here. If you don’t wan to link the deletion, you can use deleteRule: .nullify instead.
Aug ’24