Skip to content

Commit

Permalink
Update full example to show keyboard option
Browse files Browse the repository at this point in the history
  • Loading branch information
joeshonm committed May 1, 2020
1 parent 8489a78 commit 69ec7ac
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ struct ContentView: View {
// Section One
let sectionOne = SimpleFormSection()

sectionOne.model.fields.append(SimpleFormField(textField: "First Name", labelPosition: .above, name: "first_name", value: "", validation: [.email]))
sectionOne.model.fields.append(SimpleFormField(textField: "First Name", labelPosition: .above, name: "first_name", value: "", validation: [.required]))

sectionOne.model.fields.append(SimpleFormField(textField: "Last Name", name: "last_name", value: "", validation:[.required, .regex(#"^\d*$"#, "Please enter numbers only.")]))

sectionOne.model.fields.append(SimpleFormField(textField: "Email", labelPosition: .above, name: "email", value: "", validation: [.required, .email], keyboardType: .emailAddress))

self.jamForm.model.sections.append(sectionOne)

// Section Two
Expand All @@ -64,8 +66,7 @@ struct ContentView: View {

return NavigationView {
jamForm
.navigationBarTitle("Simple Form", displayMode: .inline)
.navigationBarItems(trailing: Button(action: {
.navigationBarTitle("Simple Form", displayMode: .inline).navigationBarItems(trailing: Button(action: {
let formValues = self.jamForm.getValues()
print(formValues)
let formValid = self.jamForm.isValid()
Expand Down

0 comments on commit 69ec7ac

Please sign in to comment.