From the course: SwiftUI Essential Training
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Populating collections with List
From the course: SwiftUI Essential Training
Populating collections with List
- [Instructor] We've used for each and scroll view for our lists so far. However, there's a more robust way of handling data collections, and that is a list. To start using lists, our code needs only one change. I need to replace scroll view with lists. So let's go over to menu view here and try that out. So we got a menu view over here, and here's the scroll view. I can make this really easy into a list by just doing this. And then click out here and you can see we got a list. And it's, looks a little different, it's got little dividers in here. And, it still scrolls the same way though. It's got a couple other interesting features, which we haven't played with yet. But, list is a lot more powerful than for each. You may use them together, like I did here, where you'll have a list and then a for each. Or you may use list by itself as a replacement for for each. And we're going to do both of those in this case. One of…
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
-
-
-
-
-
-
MVC versus MVVM4m 19s
-
(Locked)
State variables and buttons3m 57s
-
(Locked)
Challenge: Add a button45s
-
(Locked)
Solution: Add a button3m 50s
-
(Locked)
Use binding variables10m 10s
-
(Locked)
The Identifiable protocol5m 13s
-
(Locked)
Add a model to root views6m 47s
-
(Locked)
Populating collections with List4m 45s
-
(Locked)
Selection and binding variables6m 29s
-
-
-
-
-
-