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.
Add a model - Swift Tutorial
From the course: SwiftData Essential Training
Add a model
- [Instructor] We've seen the template. And now let's add Swift data to an application. If you haven't already, download the app from GitHub at the URL below. I've saved it to my desktop as Huli Pizza Persistence. I'm going to go pull it up here and open it up. And first thing you're going to want to do is go over here to code signing and capabilities. Make sure your automatic signing, you'll have to add your team and bundle identifier in here 'cause those are blank. And once you've done that, let's go over to where it says models over here in the code and head over to rating model here. You'll find a class with a few properties and an initializer, much like any other class. This one has a pizza name and a rating starting in X code 15. There are macros that do a lot of the work for you. The model macro makes this class into a swift data table. The properties will be the columns of that table, model is part of the swift data framework. So we'll first have to import the framework. So…