Swiftui 工具栏没有';不使用WindowGroup时不显示
我正在尝试向我的应用程序添加工具栏,但它没有显示Swiftui 工具栏没有';不使用WindowGroup时不显示,swiftui,Swiftui,我正在尝试向我的应用程序添加工具栏,但它没有显示 let root = RootView() .toolbar { ToolbarItem(placement: .primaryAction) { Button("New") {} } } window.contentView = NSHostingView(rootView: root) 我尝试了相同的代码,但使用了WindowGroup,它
let root = RootView()
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button("New") {}
}
}
window.contentView = NSHostingView(rootView: root)
我尝试了相同的代码,但使用了WindowGroup
,它确实有效。
这是否意味着
工具栏
修改器仅在我的应用程序使用SwiftUI应用程序/场景时才起作用?很可能,看起来是的。