Looking at the documentation for NSTextView, it is highly recommended that you
manipulate the NSTextStorage associated with the view. NSTextStorage is a
sub-class of NSMutableAttributedtString, so you have all of those capabilities
as well.
I’m just getting into this as well for my console app
> - I want to set the displayed contents of V to T2.
>
> What is/are the recommended way/s to do this?
>
> *I would hope that I could assign V.attributedString = T2, but alas the
> world does not seem to be this simple.*
The documentation suggests you should be working with the view’s textStorag
Did you tell V that it needs to re-load it’s display? There is a method on
NSView (from which NSTextView is derived) called “needsDisplay(sic)” which sets
a flag on the view so that the view will re-draw its content the next display
cycle. So, after you set the content to T2, you need to call
Situation:
- I am working in Swift 5.
- I have an instance of an NSTextView. (Call it "V")
- The value has already been set once. (Call this value "T1")
- V is showing T1.
- I have an NSAttributedString from another source. (Call this value
"T2")
Desired goal:
- I want to se