This answer shows how to enter a string into an NSScrollView
in Swift 4 (when developing Mac apps in Xcode 10):
@IBOutlet weak var myScrollView: NSScrollView!
myScrollView.documentView!.insertText("Hello world")
But how do you read this text (get the text string back into a variable)?
So similar to what stringValue
does for NSTextField
:
@IBOutlet weak var myTextField: NSTextField!
var myTextString = myTextField.stringValue
I'm struggling to find straightforward documentation. Apple's own documentation seems to be shallow at this point, but they are indicating that this is the right component to use: