We're very close to being done, as we did the bulk of the work in creating our custom text storage. These are the steps we have still to complete:
- Create an NSTextView programmatically, using native implementations of the NSTextContainer and NSLayoutManager classes.
- Declare the ViewController instance to be its delegate.
- Add the text view as a subview of the View Controller.
- Create an instance of CustomTextStorage and add the text view's layout manager as an observer, to be notified when changes occur.
We'll put all of those steps into a createTextView method, which we will call from the viewDidLoad method of the ViewController.
Add the following method to the ViewController class (not the CustomTextStorage ...