-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Swift 4 Programming 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 until 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:
) + N.LoginView.swift file and add a @State variable...