Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jbadger3/67a11e4239eefb85063182d400932646 to your computer and use it in GitHub Desktop.
Save jbadger3/67a11e4239eefb85063182d400932646 to your computer and use it in GitHub Desktop.
iOS manual keyboard dismissal
struct ContentView: View {
@State private var tipAmount = ""
var body: some View {
VStack {
TextField("Name: ", text: $tipAmount)
.textFieldStyle(RoundedBorderTextFieldStyle())
.keyboardType(.decimalPad)
Button("Submit") {
print("Tip: \(self.tipAmount)")
self.hideKeyboard()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment