Are there simple ways to insert a character (arrow) not at the end of the string, but where the cursor is currently located? How can I do that?
import SwiftUI
struct ContentView: View {
@State var text = ""
var body: some View {
VStack(spacing: 20) {
TextEditor(text: $text)
.font(.largeTitle)
Button("➡️"){
text.append("➡️")
}
.font(.largeTitle)
}
.padding()
}
}