title: How do I determine whether a NSTextView is scrolled to the button in Swift?
body: <p>How do I determine whether a <code>NSTextView</code> is scrolled to the buttom?</p>
  
  <p>I'm making an IRC-ish chat app. The app appends new messages to a <code>NSTextView</code> and then scrolls the view to the button.</p>
  
  <p>I want to disable the automatic down scrolling when said <code>NSTextView</code> isn't scrolled to the button, because it indicates that the user is scrolling up to read previous messages. I hope it makes sense. When appending new messages I need some way to check whether the <code>NSTextView</code> is scrolled to the button. </p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Well, turned out to be very easy. Assuming your NSTextView is "embedded" in a NSScrollView:</p>
  
  <pre><code>    if textView.visibleRect.maxY == textView.frame.maxY {
          print("YUP!")
      } else {
          print("NOPE!")
      }
  </code></pre>