Stage 2 · Lesson 8 of 10
Forms and controls
A Form groups controls into the standard iOS settings look, with Section for grouping. It works with TextField, SecureField, Toggle, Picker, Stepper and DatePicker, all bound to state with $. For , set .keyboardType(.emailAddress), and .textContentType(.password) so can fill saved passwords.
Add .textInputAutocapitalization(.never) for emails and .submitLabel(.next). Use @FocusState with .focused() to move between fields and hide the keyboard. Show validation messages below fields, and disable the submit button while a request runs.
Form suits settings and data entry. A custom login screen often uses a in a ScrollView instead.
Common trapignoring AutoFill, which annoys users with password managers.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CourseFreeSwiftUI Tutorials (Apple)
Apple · Beginner
Apple's own path from views and stacks to lists and navigation
- CourseFree100 Days of SwiftUI
Paul Hudson (Hacking with Swift) · Beginner
Days 16 to 35 build six small apps on views, modifiers, lists and animation