In my `Swift` app I have a `UITableView` and `UITextView`. The idea is simple, when user adds a text - it should appear at the bottom of the table view.

So I have an array of my object `SingleMessage`:

```
var messages = [SingleMessage]()

```

When user adds a text to `UITextView`, I send message with `Socket.IO` and receive it:

```
func messageArrived(_ notification: Notification) {
    if let message = (notification as NSNotification).userInfo?["message"] as? SingleMessage {
           DispatchQueue.main.async(execute: { () -> Void in
              messages.append(message)
              self.tview.reloadData()
              self.scrollToBottom()
     )}
    }
}

```

my function `scrollToBottom()` contains the following code:

```
if(self.messages.count > 0) {
        let iPath = IndexPath(row: self.tview.numberOfRows(inSection: 0)-1, section: self.tview.numberOfSections-1)
        self.tview.scrollToRow(at: iPath, at: UITableViewScrollPosition.bottom, animated: false)
    }

```

and then I have `cellForRow` function, that does a lot of stuff, like setting fonts and texts for each label, etc.

```
override func tableView(_ tview: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell = tview.dequeueReusableCell(withIdentifier: "chat") as! SingleCommentCell

    if let msg:SingleMessage =  self.messages[(indexPath as NSIndexPath).row] as? SingleMessage {

        .
        .
        .

```

My problem is that when I type something, then presses the `send` button immediately and start typing again - the whole interface freezes for couple seconds and I don't even see the feedback from the keyboard. I think that the problem is that the table view has to be completely refreshed. 

I'm using the interface above in the Chat component, so the problem occurs not only when user quickly types several messages in a row, but also when there're many incoming messages.

Is there any way of speeding up the whole interface, like for example add new cells at the bottom of the table view and avoid refreshing already existing ones?

The other functions related to my `UITableViewController` are:

```
override func tableView(_ tview: UITableView, numberOfRowsInSection section: Int) -> Int {

    return messages.count

}

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

    return UITableViewAutomaticDimension

}

```

Then I have:

```
override func viewDidLoad() {
    super.viewDidLoad()
    tview.separatorStyle = UITableViewCellSeparatorStyle.none
    tview.backgroundColor = UIColor.clear

    tview.delegate = self
    tview.dataSource = self

    self.tview.estimatedRowHeight = 100

    NotificationCenter.default.addObserver(self, selector: #selector(ChatView.messageArrived(_:)), name: NSNotification.Name(rawValue: incomingMessage), object: nil)
}

```