How can I scroll to TextEditor cursor position in SwiftUI
SwiftUI.TextEditor doesn't currently provide a way to scroll to a certain position within its content. To do so, consider using UITextView + UIViewRepresentative or NSTextView + NSViewRepresentative, which provide the scrollRangeToVisible(_:) method here and here.
SwiftUI.TextEditor should automatically scroll to make the cursor visible (or avoid the keyboard on iOS / iPadOS) though. If you don't see that happening, I'd be interested in taking a closer look.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.