I need to pop to the root view from a deep detail view. Found this solution on StackOverflow SwiftUI: How to pop to root view for WatchOS?. The following solution using isDetailList
and isActive
works quite well for iOS, it does not work for watchOS. The isDetailList
command is unavailable in watchOS.
Below is the code that is I am using to push a view to navigation which is bounded by a condition using the tag. So we can't use both tag and isActive parameter into NavigationLink
simultaneously. So looking for a solution that popup the root viewController
.
Button(action: {
nextBtnPressed()
}, label: {
Text("Next")
.font(.system(size: 14, weight: .semibold))
})
.frame(height: 35, alignment: .center)
.background(Color.init(hex: "0A2248"))
.cornerRadius(15)
.disabled(false)
.background(
NavigationLink(
destination: SetTimerView(shouldPopToRootView: self.$shouldPopToRootView, shower_type: self.showerType),
tag: "true",
selection: $movetoNextScreen,
label: { EmptyView() }
)
.opacity(0)
)
}