From the course: SwiftData Essential Training

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Editing error

Editing error

- [Instructor] We got things working, but there's another bug introduced to our code with the addition of persistence. Let's click on one of the pizza tickets here. I'm going to go pick this one right here. A nice margarita pizza, all right. And click on the margarita pizza. And I get the change screen here. I'm going to change this pizza size to large. And now save the pizza. And we see it down with save pizza. And now go ahead and save the ticket and the app crashes. So let's take a look at the error that this is causing here. And it's a big one, so I can just click this open. So it says, illegal attempt to establish a relationship items between objects in different contexts. So what does that mean and what's happening here? So let's stop the app. And I'm going to start over here in the order ticket. And let's remind ourselves some things here. Okay, order ticket has a property items, which is where the items are stored. And second of all, let's go back over here to ticket view. And…

Contents