From the course: Complete Guide to SwiftUI

Unlock this course with a free trial

Join today to access over 24,600 courses taught by industry experts.

Add a model to root views

Add a model to root views

- [Instructor] We don't have a real menu yet. For that, we need a model of menu items. It's time we load that into our app and see a model work. We've loaded the menu model in an earlier video in the model code group. And you'll see in there if you take a look that it's really made up of two files. It's the menu model, and it's the menu item. The menu item hasn't yet adapted identifiable, but it does have an ID, so it's not a bad idea to put it in there like so. And now I have that protocol because I have this in place. We're all set to go as far as using it for whatever I need. And then if I look a little further down here, I've got two enumerations that I'm using in my menu model right here, the item for the pizza crust and the menu category, which we'll get to as we go through the rest of the course. The menu model itself is just a collection of these, and it's just essentially a big array. Now I take that array from a JSON file, which instead of making it external files for this…

Contents