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.

The model implementation

The model implementation

- [Instructor] We've got some models to play with, and I'll use this blank version to discuss the models you've got. And I'm going to start my review with Enums, but I'm first going to get this a little bigger so we can see things well. All right, and let's start over here in the folder that says Enumerations in the models. And in here you'll find IngredientCategory and UnitOfMeasure, let's start with UnitOfMeasure. And that just has, like many commercial kitchens, metric values for what we're going to be measuring. So we have dozen, gross, kilogram, gram, milliliter. So that's pretty simple. I've also defined the types of ingredients to categories for storage and the status of the ingredient, if it's prep or if it's a refrigerated item, for example. And you can see underneath there we've got two computed properties as well, one for unit of measure because we have a default unit of measure for some kinds of items, so that, for example, if we have a unit of measure that's liquid we're…

Contents