From the course: Make SwiftUI Playgrounds Applications

Unlock this course with a free trial

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

Scroll view and list

Scroll view and list

- [Steven] The app is looking a lot better with pizza photos and menu entries. However, we want that menu to scroll. There are two ways we can do that, ScrollView and List. ScrollView does what it says. It takes any view and scrolls it, so let's give that one a try. And here I am in front of the ForEach here, and all I need to do is encompass the ForEach in the ScrollView. And there's ScrollView. Take one of those brackets, and put it after the ForEach. And you can see what happens on the side is all of a sudden, we've got our header back. And if you take a finger and scroll and swipe, you can see that we actually do get all of our pizzas now and we can see past the barbecue chicken, like we could before and see Huli and Hawaiian chicken as well. Now we can also scroll in other directions. We can do this instead of just vertical, which is the default, we can do this in a horizontal direction. So the way I would do…

Contents