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

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…

Contents