Search code examples
macosswiftuimenu

SwiftUI in macOS adding items to under the default "View" menu item


How do i add commands under the default "View" menu item in macOS?

eg. like in Finder

enter image description here


Solution

  • You can add commands after the sidebar or tab commands like this:

            .commands {
                CommandGroup(after: .sidebar) {
                    Button("Test") {}
                }
            }