SwiftUI toolbar with IDs crash since macOS 15

I understand this is a known issue, but it’s truly unacceptable that it remains unresolved. Allowing users to customize toolbars is a fundamental macOS feature, and it has been broken since the release of macOS 15.

How is it possible that this issue persists even in macOS 15.3 beta (24D5040f)?

FB15513599

import SwiftUI

struct ContentView: View {
    @State private var showEditItem = false
    
    var body: some View {
        VStack {
            VStack {
                Text("Instructions to reproduce the crash")
                    .font(.title)
                    .padding()
                Text("""
1. Click on "Toggle Item"
2. In the menu go to File > New Window
3. In new window, click on "Toggle Item" 
""")
            }
            .padding()
            
            Button {
                showEditItem.toggle()
            } label: {
                Text("Toggle Item")
            }
        }
        .padding()
        .toolbar(id: "main") {
            ToolbarItem(id: "new") {
                Button {
                    
                } label: {
                    Text("New…")
                }
            }
            
            if showEditItem {
                ToolbarItem(id: "edit") {
                    Button {
                        
                    } label: {
                        Text("Edit…")
                    }
                }
            }
        }
    }
}

SwiftUI toolbar with IDs crash since macOS 15
 
 
Q