TextEditor Problem Or Me?

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:

  1. Create a new SwiftUI macOS App project.
  2. Replace ContentView with the following code:
import SwiftUI

struct ContentView: View {
    @State private var text = "114514"
    var body: some View {
        TextEditor(text: $text)
    }
}
  1. 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 工程師能快速重現和定位問題。
如果你要用中文回報也可以,我能幫你翻譯。

clean your build folder it shouldn't do that. The assertion error doesn't have to do anything with the crash.

Tested with Xcode 16.4 both on iOS 26 simulator and iOS 18.4. Also tested a run on Mac.

Works without problem.

In addition to Clean Build Folder, you may reboot.

TextEditor Problem Or Me?
 
 
Q