4

Iterating Views, Scroll Views, FocusState, Lists, and Scroll View Reader

In this chapter, we will look at how to display lists in SwiftUI, in particular, views that have scrollable contents, either with scroll views or lists. We will also add a bit more functionality to our text fields by allowing the system keyboard to be shown or hidden on iOS. We will briefly touch on the topic of NavigationView, in order to display the titles of views.

In this chapter, we are going to cover the following main topics:

  • Iterating views
  • Hiding or showing the keyboard in a form using @FocusState
  • @SwiftUIBuilder and the limit of only 10 views
  • Controlling scrolling programmatically using ScrollViewReader

Technical requirements

You will find the code related ...

Get An iOS Developer's Guide to SwiftUI 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.