This file contains 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
import Combine | |
import SwiftUI | |
struct InputView: View { | |
let conversation: Conversation | |
@State private var inputText = "" | |
var body: some View { | |
HStack { | |
TextField("", text: $inputText) | |
.padding(6) | |
.background(Color.white) | |
Button(action: sendMessage) { | |
Text("Send") | |
} | |
}.padding(12).background(Color.init(white: 0.75)) | |
} | |
private func sendMessage() { | |
self.conversation.send(Message(sender: "PersonA", text: self.inputText)) | |
self.inputText = "" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment