How To Open A New View From Popup Menu

This is my struct view for the overflow menu

struct OverflowMenu: View {
  var body: some View {
    Menu {
      NavigationLink(destination: SettingView()) {
        Label{
          Text("Settings")
        }
        icon: {
          Awesome.Solid.cog.image
            .foregroundColor(UIColor(hex: "#ffbd16"))
        }
      }
    } label: {
      Image(systemName: "ellipsis.circle")
    }
  }
}

Nothing happens when the button is clicked. The SettingsView is not shown in a new window. And the OverflowMenuView() is inside the NavigationView. Am i missing something else?

var body: some View {
    NavigationView {
          .....
          HStack {
                Spacer()
                OverflowMenu()
          }
    }
}

Since NavigationLink does not work in a menu, some say to use binding state variables. I did manage to get it to work. But i wonder, is this the only way? It looks ugly having to have 6 state variable just for 6 menu items in the menu.

I think actions from within a view itself should cause a "drill down" / push onto the navigation stack, and It seems SwiftUI is designed to encourage this pattern as well.

I have a similar dropdown in my app that shows a settings view, and it does so as a "sheet". This ends up looking fine on both iPhone and iPad, so I've kept it.

If you actually want to open a window, you'll need to explore the openWindow utility that's in the swiftUI environment. Opening windows will only work on iPad and Mac, though.

Thanks for the tip!

How To Open A New View From Popup Menu
 
 
Q