Post

Replies

Boosts

Views

Activity

Reply to SwiftUI toolbar in MacOS 15 bug ?
I plan to implement an interface similar to Xcode, with several tool buttons on the sidebar and several tool buttons on the main interface. The main interface embeds a SplitView, which has two views on the left and right. The tool buttons should change with the switching of the left view. In MacOS14, there is no problem with the code. When it is updated to 15, there is a problem. NSToolbar 0x6000005665b0 already contains an item with the identifier com.apple.SwiftUI.splitViewSeparator-0. Duplicate items of this type are not allowed. In addition, I found that if I don't use SplitView, there will be no problem. I tried setting the id of the ToolbuttonItem, but it didn't work.
Sep ’24
Reply to SwiftUI toolbar in MacOS 15 bug ?
Same problem. struct ContentView: View { var body: some View { NavigationSplitView { List { Text("row 1") Text("row 2") Text("row 3") } } detail: { HSplitView { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .toolbar(id: "toolbar", content: { ToolbarItem { Button("bb", action: onToolbar) } ToolbarItem { Button("cc", action: onToolbar) } }) .padding() Text("right") } }.navigationTitle("") } func onToolbar() {} } FAULT: NSInternalInconsistencyException: NSToolbar 0x600001f10f30 already contains an item with the identifier com.apple.SwiftUI.splitViewSeparator-0. Duplicate items of this type are not allowed.; { NSAssertFile = "NSToolbar.m"; NSAssertLine = 1609; }
Sep ’24