Answers for "dismiss keyboard textfield swiftui"

1

how to dismiss keyboard swiftui

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()
            }
        }
    }
}
Posted by: Guest on November-24-2020

Code answers related to "dismiss keyboard textfield swiftui"

Code answers related to "Swift"

Browse Popular Code Answers by Language