1

I would like to push to a new view from a menu button but my implementation doesn't seem to work. I have searched SO and most solutions use the NavigationLink, but doesn't seem to work in a Menu button.

Code:

ToolbarItem(placement: .navigationBarTrailing) {
    Menu {
        NavigationLink(
            destination: ReadMoreView(),
            label: {
                Label("Read more", systemImage: "ellipses")
            })
    }
    label: {
        Text("Next")
    }
}

Other attempts:

ToolbarItem(placement: .navigationBarTrailing) {
    Menu {
        Button(action: {
           NavigationLink(destination: ReadMoreView())
        }) {
            Label("Read more", systemImage: "ellipses")
        }
    }
    label: {
        Text("Next")
    }
}
Koh
  • 2,687
  • 1
  • 22
  • 62

0 Answers0