title: start scrolling when the UITextView hits a certain number of lines? swift 4
body: <p>So I'm making a messaging app, and I have an <code>inputAccessoryView</code> called <code>typingView</code>, which contains a <code>messageTextView: UITextView</code> and <code>sendButton: UIButton</code>. I have a separate class that is called <code>class InputAccessoryView: UIView, UITextViewDelegate</code>. This is my code for setting up the <code>inputAccessoryView</code>:</p>
  
  <pre><code>var typingView: InputAccessoryView!
  
  lazy var typingViewContainer: UIView = {
      typingView = InputAccessoryView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: fakeTypingViewHeight.constant))
      return typingView
  }()
  
  override var inputAccessoryView: UIView? {
      get {
          return typingViewContainer
      }
  }
  
  override var canBecomeFirstResponder: Bool {
      get {
          return true
      }
  }
  </code></pre>
  
  <p>Then I add an observer to act on the event that the contentSize of the UITextView changes:</p>
  
  <pre><code>messageTextView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
  </code></pre>
  
  <p>I handle this correctly - every time the contentSize changes by <em>x</em> lines, I increase the height of the <code>typingView</code> by the height of <em>x</em> lines by calling <code>typingView.invalidateIntrinsicContentSize()</code>. Something like <a href="https://stackoverflow.com/a/32647908/9477827">this</a>.</p>
  
  <p>Here is my code for recalculating the size:</p>
  
  <pre><code>override var intrinsicContentSize: CGSize {
      let sizeToFitIn = CGSize(width: messageTextView.bounds.size.width, height: .greatestFiniteMagnitude)
      let newSize = messageTextView.sizeThatFits(sizeToFitIn)
      let newHeight = newSize.height
      return CGSize(width: bounds.width, height: newHeight)
  }
  </code></pre>
  
  <p>Also, <code>messageTextView.isScrollEnabled = false</code>, because of <a href="https://stackoverflow.com/a/18931531/9477827">this post here</a>.</p>
  
  <p>So it recalculates the height correctly every time the contentSize changes, but my question is: <strong>If I want the UITextView to start scrolling at say, 5 lines, how would I do that?</strong></p>