I have created an NSTextView
and managed to populate it using a getter for the scroll view that it is nested in, and using the .insertText()
function.
How do I empty the same NSTextView
? I have read the documentation and there doesn't seem to be a function .removeText()
. It seems a bit weird that Apple would allow you to insert data but not remove it programmatically. I have searched high and low for answers but have come up empty handed.
You can't set the text of the text view directly, but you can set its textStorage
's, getting that object's mutableString
, which it inherits from NSMutableAttributedString
, and then using setString()
, passing an empty string.
No idea what I was thinking. Use var string { get set }
, inherited from NSText
.