
SwiftUI Cookbook
By :

Forms provide a means of getting information from the user. Long forms can, however, discourage users from providing information. Users not completing a form may mean fewer people signing up for your app or providing payment information.
In this recipe, we will learn how to show/hide an additional address section of a form based on user input.
Create a SwiftUI Project named SignUp
.
We will create a signup form with sections for various user input. The additional address sections will be shown or hidden based on how long the user has lived at their current address. Use the following steps:
signUpView
:a. Press ⌘ + N.
b. Select SwiftUI View.
c. Click Next.
d. Click on the Save As field and enter the text signUpView
.
e. Click Finish.
@State
variables that will be used in the form:@State private var fname = "" @State...