Change text in NSScrollView

Hello, I need to change the text of an NSScrollView at run time, but the command below is not working:

ScrViwRegras.documentView?.insertText (rules.retornaTextoRegras())

Where Rules is a struct that has the returnTextoRegras() method that returns the new text.

Has anyone had this problem?

Xcode 15.0.1 in MacBook Air not iOS), Swift 5,

Hugs

Change text in NSScrollView
 
 
Q