Skip to content

Commit 2ac68a4

Browse files
authored
Update README.md
1 parent e627e04 commit 2ac68a4

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -69,43 +69,43 @@ import Formulaire
6969
import SwiftUI
7070

7171
struct SignUpView: View {
72-
@State private var form = SignUpForm()
73-
74-
var body: some View {
75-
FormulaireView(editing: $form) { form in
76-
form.textField(for: \.firstName, label: "First name")
77-
form.textField(for: \.lastName, label: "Last name")
78-
form.stepper(for: \.age, label: "Age", step: 1, range: 0...120)
79-
80-
form.content(for: \.preferences) { error in
81-
Section {
82-
ForEach(invoice.preferences) { preference in
83-
let scoped = form.scope(\.preferences, for: preference)
84-
scoped.toggle(for: \.isEnabled, label: preference.name)
85-
}
86-
} footer: {
87-
if let error {
88-
Text(error.localizedDescription)
89-
}
90-
}
91-
}
92-
93-
// Use a default submit button...
94-
form.submitButton("Create Account") {
95-
// Handle success
96-
print("Submitted")
97-
}
98-
99-
// ... or handle it with your own logic.
100-
Button("Done!") {
101-
let success = form.validate()
102-
if success {
103-
// handle success
104-
}
105-
}
72+
@State private var form = SignUpForm()
73+
74+
var body: some View {
75+
FormulaireView(editing: $form) { form in
76+
form.textField(for: \.firstName, label: "First name")
77+
form.textField(for: \.lastName, label: "Last name")
78+
form.stepper(for: \.age, label: "Age", step: 1, range: 0...120)
79+
80+
form.content(for: \.preferences) { error in
81+
Section {
82+
ForEach(invoice.preferences) { preference in
83+
let scoped = form.scope(\.preferences, for: preference)
84+
scoped.toggle(for: \.isEnabled, label: preference.name)
85+
}
86+
} footer: {
87+
if let error {
88+
Text(error.localizedDescription)
89+
}
10690
}
107-
.padding()
91+
}
92+
93+
// Use a default submit button...
94+
form.submitButton("Create Account") {
95+
// Handle success
96+
print("Submitted")
97+
}
98+
99+
// ... or handle it with your own logic.
100+
Button("Done!") {
101+
let success = form.validate()
102+
if success {
103+
// handle success
104+
}
105+
}
108106
}
107+
.padding()
108+
}
109109
}
110110
```
111111

0 commit comments

Comments
 (0)