Using scroll views
You can use SwiftUI scroll views when the content to be displayed cannot fit in its container. Scroll views create scrolling content where users can use gestures to bring new content into the section of the screen where it can be viewed. Scroll views are vertical by default but can be made to scroll horizontally or vertically.
In this recipe, we will learn how to use horizontal and vertical scroll views.
Getting ready
Let’s start by creating a SwiftUI project called WeScroll
.
Optional: If you don’t have it yet, download the San Francisco Symbols (SF Symbols) app here: https://developer.apple.com/sf-symbols/.
As we mentioned in Chapter 1, Using the Basic SwiftUI Views and Controls, SF Symbols is a set of over 5,000 symbols provided by Apple at the time of this writing.
How to do it…
Let’s learn how scroll views work by implementing horizontal and vertical scroll views that display SF symbols for alphabet characters...