I'm building a real time chat application. Where I use message kit and inputBarAccessoryView library to make a conversation between 2 users.
I've used -
extension ChatViewController: InputBarAccessoryViewDelegate {
func inputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {
// message sending logic
}
}
this delegate function but when I pressed send button the message is sent but the text is still remain in the inputBar it is not getting cleared.
How can I clear the inputBar text when user click the Send Button?
I've found the solution in this question's answer.
Adding this line -
at the end of the
func inputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String)
function clears the text after clicking send button.