- Set up the delegate for all of your
UITextField
s. - Implement validation when a user taps the return button on the keyboard. Check out the documentation for which method you need.
- The validation rules are as follows:
* First Name:
-
0 characters
- No Digits * Last Name:
-
0 characters
- No Digits * Email:
-
0 characters
- valid email format (something@something.something) * Username:
-
0 characters
- No Digits * Password:
-
6 characters
-
- When the user taps return on each field - you should validate it, then present a
UIAlertController
with an appropriate error message. The alert view should have two buttons:OK
andClear
. When you pressClear
it should clear the currently editing textfield. - Start with only the first textfield
enabled
. If a textfield passes validation, then set theenabled
property of the next textfield totrue
(and so on and so forth). - When the final textfield is correct, enable the sign up button.
- To dismiss the keyboard call resignFirstResponder instance method on the currently editing
UITextField
. To move the focus to anotherUITextField
call the becomeFirstResponder instance method on theUITextField
you want to be focused.
- This lab lends itself to some messy code if you don't put a lot of thought into the software design. How clean can you make the code? Remember each method should be short. Minimal copy-paste. Descriptive Names.
View Validated Sign Up on Learn.co and start learning to code for free.