             }
         }
 
-        showButtonScrollToBottom = !chatLogIsAtBottom()
+        scrollToBottomButtonIsVisible = !chatLogIsAtBottom()
     }
 }
 

        }
    }
}



    @IBOutlet weak var buttonScrollToBottom: UIButton!
    var buttonScrollToBottomMarginConstraint: NSLayoutConstraint?

    var scrollToBottomButtonIsVisible: Bool = false {
        didSet {
            self.buttonScrollToBottom.superview?.layoutIfNeeded()

            if self.scrollToBottomButtonIsVisible {
                self.buttonScrollToBottomMarginConstraint?.constant = (self.textInputbar.frame.origin.y - self.view.frame.height) - 40
            } else {
                self.buttonScrollToBottomMarginConstraint?.constant = 50
            }

            if scrollToBottomButtonIsVisible != oldValue {
                UIView.animate(withDuration: 0.5) {
                    self.buttonScrollToBottom.superview?.layoutIfNeeded()
                }
