Answers for "swiftui text input field"

1

add textfield in swiftui

struct ButtonAndTextFieldView : View {

    @State var text: String = ""

    var body: some View {
        HStack {
            TextField($text,
                      placeholder: Text("type something here..."))
            Button(action: {
                // Closure will be called once user taps your button
                print(self.$text)
            }) {
                Text("SEND")
            }
        }
    }
}
Posted by: Guest on March-13-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language