I am "pushing" a new view using NavigationLink
like this:
NavigationLink(destination: SomeView(shown: $isActive)), isActive: $isActive) { ... }
Inside SomeView
i can now set shown
to false
to "pop" back. This works.
However, if show an Alert inside SomeView
this no longer works. When showing the alert I also get this error message in the console:
popToViewController:transition: called on <_TtGC7SwiftUI41StyleContextSplitViewNavigationControllerVS_19SidebarStyleContext_ 0x7ffc1e858c00> while an existing transition or presentation is occurring; the navigation stack will not be updated.
What am I doing wrong?
Here's how I am showing the alert inside SomeView
:
VStack
{
// ...
}
.alert(isPresented:$showAlert)
{
Alert(title: Text("Some text"), message: Text("More text"), dismissButton: .default(Text("OK")))
}
I show the alert by setting showAlert
to true.