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.
Post
Replies
Boosts
Views
Activity
There is no problem with entering English, but a warning appears when entering Chinese.
[Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
TextField also has the same problem.
macOS: 13.0.1 (22A400)
struct ContentView: View {
@State var searchString: String = ""
var body: some View {
VStack {
TextEditor(text: $searchString)
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.padding()
}
}