As the questions says I want to navigate to another view without NavigationButton, something like "pushView" and "popView" in UIkit
1 Answer
I consider this more like a work-around for a limitation, but it worked for me:
Add a boolean state variable which defines whether the link is active. E.g.:
@State private var showLinkTarget = false
Add an invisible NavigationLink like this:
NavigationLink(destination: LinkTargetView(), isActive: self.$showLinkTarget ) {
Spacer().fixedSize()
}
3 Comments
atulkhatri
The problem is that this logic only works once in my case
moger777
Alternatively use EmptyView instead of Spacer().fixedSize()
Alexander Jährling
If it only works once, did you made sure that you set showLinkTarget to false again on return?
PresentationButtonPresentationButtonis correct answer as @Anbu.Karthik said.NavigationButton?