I'm making an app using SwiftUI and trying to use the TextEditor view. However when I run it, and I try entering text into the TextEditor, the characters don't appear, they do however appear in the terminal that i used to run the app. The same problem exists with the TextField view.
I usually run it using swift run but have also tried swift build and running the produced executable as well as using release mode.
Minimal example:
import SwiftUI
@main
struct Example: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
@State var text: String = ""
var body: some View {
TextEditor(text: $text)
}
}