From the course: iPadOS 13 Development Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Creating a SwiftUI navigation model - iOS Tutorial
From the course: iPadOS 13 Development Essential Training
Creating a SwiftUI navigation model
- [Instructor] Now let's look at adding a data model to our View. So we have our NavigationView, we have a list of items. Let's say that list comes from an array, because without that list isn't as useful. So what we're going to need to do first, is create a data model. So we'll call this struct item, and it's going to inherit from identifiable, which just means it has a property called id. And this has to be unique. And then we'll create a variable called description, that will be a string. And then in our DetailView, let's receive that item. So we create a property called item. And then in the text, we'll have item.description. Now we have an error right here. Don't worry about that for now. We're going to address to it, momentarily. Now we need to create our data model, which will be an array of item objects. So create a variable called items. And this is going to be an array of items. And we'll set it equal…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
SwiftUI basics4m 46s
-
Previewing multiple platforms in SwiftUI2m 53s
-
(Locked)
Using SwiftUI to create navigation4m 10s
-
(Locked)
Creating a SwiftUI navigation model3m 4s
-
(Locked)
Setting a default selection2m 58s
-
(Locked)
Working with unsupported views in SwiftUI2m 24s
-
(Locked)
Challenge: Add an image1m 43s
-
(Locked)
Solution: Add an image2m 44s
-
(Locked)
-
-
-
-
-