Scroll TextEditor to cursor position

Hello.

Is there a good SwiftUI approach on getting the TextEditor cursor position?

I have a TextEditor and sometimes when we have a longer text inside it, the cursor is not seen because the keyboard is above covering the bottom of the TextEditor.

I would like to somehow detect the position of the cursor, and if it's on the last line of the TextEditor, scroll to the bottom. I've already checked a bit and didn't find any good method of doing this in SwiftUI.

If you have any ideas on how to do this, or even a different method any help would be highly appreciated.

Thank you!

I would love to have an answer to this too. It sees that TextEditor still has plenty of bugs that make it really difficult to use as a UITextView replacement...

Scroll TextEditor to cursor position
 
 
Q