In the following example, I added the scrollView in the interface builder as my starting point.
The following works if you your scrollView/textView is empty/blank OR if you need to append text in front of what is already in the scrollView/textView. If there is already text in the box, the new text is inserted in front of the existing text.
The documentView is an NSTextView
Swift 4.0
@IBOutlet weak var imageDestinationDirectory: NSScrollView!
...
let destinationText = "Text to display"
imageDestinationDirectory.documentView!.insertText(destinationText)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…