The form view
To wrap up the main view, we need to work on the bottom section, which contains the form. You will learn how to customize a generic form. Since SwiftUI is new, we will not be able to customize our form using only SwiftUI. SwiftUI forms are built on top of UITableView
, so a lot of our customizations will be made to the table view itself. Let's get started by opening FormView
, and before we get started, you will notice this:
@ObservedObject var order = OrderViewModel()
You will see this in a few files throughout this chapter. I have added some basic defaults for this file in OrderViewModel.swift
that we will use to get our form working and some other logic we need in this app. This file and the default values are not necessary. We are only using it for prototyping and nothing more. In Chapter 5, Car Order Form – Data, we will rewrite this code. For now, we are going to just focus on design in this chapter.
Creating the form sections
- Inside
FormView...