Chapter 8
Displaying Confirmations and Handling List View Selection

There is no learning without trying lots of ideas and failing lots of times.

- Jonathan Ive

Are you able to complete the previous exercise and create the redesigned row layout? If not, don't worry. In this chapter, I will guide you through the solution and introduce some new layout techniques. Up until now, our focus has been on displaying data in a list view. However, you may be curious about how we can interact with the list view and detect row selections. This is precisely what we will discuss in this chapter.

To begin, first download the complete project we built in the previous chapter. We will continue to enhance the app and make it even better. In brief, here are what we are going to implement:

  • Add an alternate design of the row layout
  • Bring up a menu when a user taps one of the items in the list view. The menu offers two options: Reserve a table and Mark as favorite.
  • Display a heart icon when the user selects the Mark as favorite option.

Through implementing these new features, you will also learn how to better organize the SwiftUI code and use actions sheets to display alerts in iOS.

Figure 8-1. Sample alerts in Shortcut and Medium apps
Figure 8-1. Sample alerts in Shortcut and Medium apps

To access the full version of the book, please get the full copy here. You will also be able to access the full source code of the project.

results matching ""

    No results matching ""