Form groups input controls into a clean, settings-style screen.
struct SettingsView: View {
@State private var name = ""
@State private var notify = true
@State private var theme = "Light"
var body: some View {
Form {
TextField("Name", text: $name)
Toggle("Notifications", isOn: $notify)
Picker("Theme", selection: $theme) {
Text("Light").tag("Light")
Text("Dark").tag("Dark")
}
}
}
}
Tip: Bind each control to a @State value with
\$; the UI and data stay in sync automatically.Summary
Forms organise TextField/Toggle/Picker inputs, each bound to state, for clean data-entry screens.