title: SwiftUI: Changing default Command Menus on macOS
body: <p>I'm trying to change the default commands in a macOS SwiftUI app. I would like to append some custom commands to the 'View' menu, but I can't get it to work.</p>
  <p>This is what I tried:</p>
  <pre><code>@main
  struct MyApp: App {
  
      var body: some Scene {
          
          WindowGroup {
              AppView()
                  .environmentObject(AppModel.shared)
                  .environment(\.managedObjectContext, AppModel.shared.cloudKitCoordinator.coreDataStack.viewContext)
          }
          .commands {
              ViewCommands()
              SidebarCommands()
              ElementCommands()
              NavigationCommands()
          }
          
      }
      
  }
  
  struct ViewCommands: Commands {
  
      var body: some Commands {
          
          CommandMenu(&quot;View&quot;) {
              Button(&quot;Do something View related&quot;) {}
          }
          
      }
      
  }
  </code></pre>
  <p>But instead of appending the command to the 'View' menu, it creates a second menu with the same name:</p>
  <p><a href="https://i.stack.imgur.com/4HR8w.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4HR8w.png" alt="enter image description here" /></a></p>
  <p>Has anyone had luck changing the default command menu's or is this just a part of SwiftUI that's still a little raw?</p>