-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

SwiftUI Cookbook
By :

Form fields may have additional requirements such as minimum text length or a combination of uppercase and lowercase characters. We may want to perform actions based on the user's input, such as disabling a Submit button till all requirements are met.
In this recipe, we will create a sign-in view where the Submit button only gets enabled if the user enters some content in both the username and password fields.
Create a SwiftUI project called FormFieldDisable
.
We will create a login screen containing a username, password, and a Submit button. We will disable the Submit button by default and only enable it when the user enters some text in the username and password fields. The steps are given here:
LoginView
:a. Press Command () + N.
b. Select SwiftUI View.
c. Click Next.
d. Enter LoginView
in the Save as field.
e. Click Finish.
LoginView.swift...