SwiftUI TextEditor autoscrolling

how do i make TextEditor autoscrolled? i want to implement a log view based on it - when the scroll position is at bottom, adding new lines shall autoscroll it upwards so the newly added lines are visible. and when the scroll position is not at bottom - adding new lines shall not autoscroll it.

where is the best place for SwiftUI questions?

Scrolling texteditor windows under program control or automatically as in the question above seems to be a common problem with an awful lot of attempts to work round it on the net. None of which seem to work reliably. Some advice / fixes would be hugely helpful.

  1. You can write a custom NSViewRepresentable to reach down to AppKit
  2. You can search for an SPM git package called introspect
SwiftUI TextEditor autoscrolling
 
 
Q