     /// Prepares the textView.
     fileprivate func prepareTextView() {
         textView = TextView(textContainer: textContainer)
+        textView.delegate = self
         addSubview(textView)
     }
     

        delegate?.editor?(editor: self, didProcessEditing: textStorage, text: string, range: range)
    }
}

     */
    @objc
    optional func editor(editor: Editor, didProcessEditing textStorage: TextStorage, text: String, range: NSRange)
    
    /**
     A delegation method that is executed when the textView should begin editing.
     - Parameter editor: An Editor.
     - Parameter shouldBeginEditing textView: A UITextView.
     - Returns: A boolean indicating if the textView should begin editing, true if
     yes, false otherwise.
     */
    @objc
    optional func editor(editor: Editor, shouldBeginEditing textView: UITextView) -> Bool
    
    /**
     A delegation method that is executed when the textView should end editing.
     - Parameter editor: An Editor.
     - Parameter shouldEndEditing textView: A UITextView.
     - Returns: A boolean indicating if the textView should end editing, true if
     yes, false otherwise.
     */
    @objc
    optional func editor(editor: Editor, shouldEndEditing textView: UITextView) -> Bool
    
    /**
     A delegation method that is executed when the textView did begin editing.
     - Parameter editor: An Editor.
     - Parameter didBeginEditing textView: A UITextView.
     - Returns: A boolean indicating if the textView did begin editing, true if
     yes, false otherwise.
     */
    @objc
    optional func editor(editor: Editor, didBeginEditing textView: UITextView) -> Bool
    
    /**
     A delegation method that is executed when the textView did begin editing.
     - Parameter editor: An Editor.
     - Parameter didBeginEditing textView: A UITextView.
     - Returns: A boolean indicating if the textView did begin editing, true if
     yes, false otherwise.
     */
    @objc
    optional func editor(editor: Editor, didEndEditing textView: UITextView) -> Bool
    
    /**
     A delegation method that is executed when the textView should change text in
     a given range with replacement text.
     - Parameter editor: An Editor.
     - Parameter textView: A UITextView.
     - Parameter shouldChangeTextIn range: A NSRange.
     - Parameter replacementText text: A String.
     - Returns: A boolean indicating if the textView should change text in a given
     range with the given replacement text, true if yes, false otherwise.
     */
    @objc
    optional func editor(editor: Editor, textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool
    
    /**
     A delegation method that is executed when the textView did change.
     - Parameter editor: An Editor.
     - Parameter didChange textView: A UITextView.
     */
    @objc
    optional func editor(editor: Editor, didChange textView: UITextView)
    
    /**
     A delegation method that is executed when the textView did change a selection.
     - Parameter editor: An Editor.
     - Parameter didChangeSelection textView: A UITextView.
     */
    @objc
    optional func editor(editor: Editor, didChangeSelection textView: UITextView)
}

open class Editor: View {
