I have a List
that contains NavigationLink
inside a NavigationView
.
I know want to extend the view with a ContextMenu
that contains an element that shows another view inside my navigation stack.
struct MainView: View {
@State var elements = ["Hello", "World"]
var body: some View {
NavigationView {
List(elements, id: \.self, rowContent: { element in
NavigationLink(destination: PresentView(element: element)) {
Text(element)
.contextMenu {
NavigationLink(
"Edit",
destination: EditView(element: element)
)
}
}
})
}
}
}
The navigation for a normal tap on my item works fine. The context menu however stopped working in Xcode 11 Beta 5. I get the following error: `[WindowServer] display_timer_callback: unexpected state.
How would I push a new view on my navigation stack from a context menu?
NavigationLink
with simple buttons setting a state in my navigation view to push new views. – jlsiewert