These are the lesson notes for this day. Its build-along tutorial and flash cards have not been written yet.
SwiftUI's controls — Button, Toggle, Picker, Slider, Stepper, DatePicker — each bind to a piece of state, and each changes its appearance to suit where it is placed. A Form groups controls into the standard settings layout and styles each one appropriately. You change how a control looks with a style: .buttonStyle(.borderedProminent), .pickerStyle(.segmented). You write your own by conforming to a protocol such as ButtonStyle.
Coming from UIKit: there are no target–action pairs and no delegates. A control is bound to a value. When the user changes the control, the value changes, and the views that depend on it update.
ExerciseBuild a settings screen in a Form with a toggle, a segmented picker, a stepper, and a slider, all backed by one @Observable settings object. Write a custom ButtonStyle for its Save button.
Toggle report the user's change to your code?Form do for the controls inside it?TextField binds to a string, or to another type if you give it a format: (for numbers and dates). SecureField hides what is typed. TextEditor handles several lines and, since iOS 26, rich text through AttributedString. You configure the keyboard with .keyboardType, .textContentType, .textInputAutocapitalization and .submitLabel, and you respond to the Return key with .onSubmit.
Focus is state as well. A @FocusState property holds which field has the keyboard. You connect fields to it with .focused(), and you move focus by assigning to it. That replaces becomeFirstResponder.
Build a login form with two fields. Pressing Return in the first field moves focus to the second; pressing Return in the second submits. The Submit button is disabled until both fields are valid.
After this lesson you should be able to answerTextField to a number instead of a string?