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 - Swift Tutorial
From the course: Make SwiftUI Playgrounds Applications
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
-
-
-
(Locked)
More on the view hierarchy12m 11s
-
(Locked)
Formatted numbers8m 23s
-
(Locked)
Computed properties6m 7s
-
(Locked)
Arrays9m 54s
-
(Locked)
For loops9m 42s
-
(Locked)
Use ForEach in SwiftUI8m 32s
-
(Locked)
Protocols, Hashable, and Identifiable3m 56s
-
(Locked)
Importing models and assets8m 27s
-
(Locked)
Adapting models8m 43s
-
(Locked)
Scroll view and list6m 34s
-
Work with @State and toggle buttons8m 43s
-
(Locked)
Make Button arrays7m 13s
-
(Locked)
Work with @Binding5m 59s
-
(Locked)
Enumeration types8m 45s
-
(Locked)
Selection from lists4m 21s
-
(Locked)
Optional values6m 10s
-
(Locked)
-