Created
November 10, 2020 19:39
-
-
Save jbadger3/9762e8a2e99081797376c4e904cc6bc9 to your computer and use it in GitHub Desktop.
iOS manual keyboard dismissal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct FormViewFix1: View { | |
@State var name = "" | |
@State var yearsExpereince: Int = 0 | |
var body: some View { | |
NavigationView { | |
Form { | |
Section(header: Text("Applicant Info"), content: { | |
HStack { | |
Text("Name:") | |
.fontWeight(.thin) | |
TextField("", text: $name).background(Color(.systemYellow).opacity(0.3)) | |
} | |
Picker("Years of experience:", | |
selection: $yearsExpereince, | |
content: { | |
ForEach(0..<11) { years in | |
Text("\(years)") | |
} | |
}) | |
HStack { | |
Spacer() | |
Button(action: { | |
print("Submit button pressed.") | |
}, | |
label: { | |
Text("Submit") | |
}) | |
.padding(3) | |
.overlay( | |
RoundedRectangle(cornerRadius: 6) | |
.stroke(lineWidth: 1.5) | |
.foregroundColor( Color(.systemBlue) ) | |
) | |
Spacer() | |
} | |
}) | |
} | |
.onTapGesture { | |
self.hideKeyboard() | |
} | |
.navigationTitle(Text("Application")) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment