Toolbar doesn't appear when not using WindowGroup

Viewed 62

I'm trying to add a toolbar to my app but it doesn't show up.

let root = RootView()
   .toolbar {
         ToolbarItem(placement: .primaryAction) {
                Button("New") {}
         }
    }
window.contentView = NSHostingView(rootView: root)

I've tried the same code but with using WindowGroup and it does work. Does it mean that the toolbar modifier will only work if my app is using SwiftUI App/Scenes?

0 Answers
Related