   
   private func setupTextKitHierarchy() {
     layoutManager.allowsNonContiguousLayout = true
+    layoutManager.delegate = self
     textStorage.addLayoutManager(layoutManager)
     textContainer.lineBreakMode = NSLineBreakMode.ByWordWrapping
     textContainer.widthTracksTextView = true


import UIKit

class EditorTextViewController: UIViewController, UITextViewDelegate {
  let textStorage = EditorTextStorage()
  let layoutManager = NSLayoutManager()
  let textContainer = NSTextContainer()

  func textViewDidChange(textView: UITextView!) {
    self.textView.resizeLineNumberGutter()
  }
  
  func layoutManager(layoutManager: NSLayoutManager, lineSpacingAfterGlyphAtIndex glyphIndex: Int, withProposedLineFragmentRect rect: CGRect) -> CGFloat {
    return 5;
  }
}
