I'm working on a macOS app using SwiftUI. In the main view of the app, I have a list, with each element acting as a NavigationLink. In the destination view of each element, I want to have a NavigationLink to a third view that covers all the second view (like in WhatsApp for Mac or in iOS).
The problem is that when I'm clicking on the NavigationLink, nothing happens (the button appears as a disabled button). Also, I tried to have the navigation link activated by a @State, but the third view appears as a popover.
The maim view:
NavigationView {
List {
ForEach(elements) { elements in {
NavigationLink(destination: FirstDetailView(element: element)) {
ElementRowView(element: element)
.accentColor(listAccentColor)
}
}
}
}
The first detail view:
Group {
GeometryReader { geo in
List {
ForEach(elements) { element in
InnerElementView(element: element)
}
}
}
.toolbar {
ToolbarItem {
Button {
showThirdView.toggle()
} label: {
Image(systemName: "square.and.pencil")
.font(.system(size: ListView.buttonSize))
}
}
}
NavigationLink(destination: ThiredView(),
isActive: $showThirdView) { EmptyView() }
.hidden()
}
macOS 11.0.1 (RC2)
Xcode 12.2 (latest from the App Store)
When I'm using the link as the button:

