     }
 
     override open func viewDidLayoutSubviews() {
-        messagesCollectionView.contentInset = UIEdgeInsets(top: topLayoutGuide.length, left: 0, bottom: messageInputBar.frame.height, right: 0)
+        messagesCollectionView.contentInset.top = topLayoutGuide.length
     }
 
     // MARK: - Initializers

        let keyboardFrame = self.view.convert(keyboardEndFrame, from: self.view.window)

        switch notification.name {
        case Notification.Name.UIKeyboardDidChangeFrame, Notification.Name.UIKeyboardWillShow:
            if (keyboardFrame.origin.y + keyboardFrame.size.height) > view.frame.size.height {
                // Hardware keyboard is found

extension MessagesViewController {
    
    fileprivate func addKeyboardObservers() {

        NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardDidChangeState), name: .UIKeyboardDidShow, object: nil)
        NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardDidChangeState), name: .UIKeyboardWillHide, object: nil)
        NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardDidChangeState), name: .UIKeyboardWillShow, object: nil)
        NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardDidChangeState), name: .UIKeyboardWillChangeFrame, object: nil)
