Reproduction procedure
- Launch Xcode and press shift+command+N to create a macOS App project.
- Edit the generated ContentView.swift to the following content:
struct ContentView: View {
@State var txt: String = “”
var body: some View {
VStack {
Text(“Hello, world!\(txt)”)
TextField(“input”, text: $txt)
onSubmit { // lack of a period letter.
// .onSubmit { // Correct code
print(“onSubmit\(txt)”)
}
}
}
}
- Build with command+B and it succeeds.
- Debug with command+R, but a rainbow wheel appears and the window does not show.
- An error is displayed in Xcode’s Preview Canvas, preventing preview.