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.

Post not yet marked as solved Up vote post of yetanotherme Down vote post of yetanotherme
1.9k views
  • 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.

Add a Comment

Replies

where is the best place for SwiftUI questions?

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