Displaying Scrollable Content with Lists and Scroll Views

In this chapter, we’ll learn how to display scrollable content with scroll views and lists in SwiftUI. Scrollable content is a solution for when we need to show information to the user that doesn’t fit on a single screen. Using a drag gesture, the user can scroll through the content we display, usually a list of items. We have plenty of examples of this in iOS, such as the mail app, showing a list of our emails, or the stocks app, showing a list of our favorite stocks.

ScrollView is a powerful container view used to scroll content and is used when the content is somehow unrelated. For logically related content, we usually use a List.

List views are like UITableViews in UIKit but are ...

Get SwiftUI Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.