struct ContentView: View {
var body: some View {
NavigationSplitView {
List {
Text("row 1")
Text("row 2")
Text("row 3")
}
.toolbar(content: {
ToolbarItem {
Button("aa", action: onToolbar)
}
})
} detail: {
HSplitView {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.toolbar(id: "toolbar", content: {
ToolbarItem(id: "toolbar-1") {
Button("bb", action: onToolbar)
}
})
.padding()
Text("right")
}
}.navigationTitle("")
}
func onToolbar() {}
}
Run & Crash
NSToolbar 0x6000005665b0 already contains an item with the identifier com.apple.SwiftUI.splitViewSeparator-0. Duplicate items of this type are not allowed.