I would like to understand how to programmatically set the position of a cursor in a SwiftUI TextField.
In UIKit this can be done using the selectedTextRange property, but I couldn't find a similar way to achieve this with pure SwiftUI.
I want to figure out something like setCursorPosition (index:) - maybe by tracking the position in a @State or any other way.
I understand that I can do this using UIViewRepresentable but I am looking for a pure SwiftUI solution and wanted to know if there is any.