When using SwiftUI's TextEditor, the application crashes immediately on launch.
This occurs even in a brand new project with the simplest usage.
If I remove the TextEditor, the application runs normally.
Environment:
- OS: macOS 15.6.1
- Xcode: 16.4
- SDK: macOS 14 (and also tried with macOS 15 SDK)
Steps to Reproduce:
- Create a new SwiftUI macOS App project.
- Replace ContentView with the following code:
import SwiftUI
struct ContentView: View {
@State private var text = "114514"
var body: some View {
TextEditor(text: $text)
}
}
- Run the app.
Expected Result:
The app should display a working TextEditor.
Actual Result:
The app immediately crashes, and the debugger shows a Metal assertion error.
If I remove the TextEditor, the app works fine.
Screenshot:
Additional Notes:
- This issue did not occur on macOS 14 / Xcode 15.4.
- It reproduces even in an empty project.
- Possibly related to SwiftUI/Metal integration on macOS 15.6.1.
這樣寫更專業、清楚,Apple 工程師能快速重現和定位問題。
如果你要用中文回報也可以,我能幫你翻譯。