I'm using TabView
on my home page. Let's just say I have 4 tabs.
On second tab, i can go to another view using NavigationLink
and I go to another 2 views using NavigationLink
. Then on the latest view, there is a button to present a view and i use .fullScreenCover
(since I want to present it full screen).
In the presenting view, I add an X
mark on the left side of the navigationBarItems
to dismiss. I use @Environment(\.presentationMode) var presentationMode
and presentationMode.wrappedValue.dismiss()
to dismiss. But it only dismiss the presenting view to the previous view, while actually I want to dismiss it to the root of my view which is the 2nd tab of my TabView
.
Is there a way to do this? Because I have looked up to some articles and nothing relevant especially in TabView
context.
I also have a question tho:
- Is it a right approach to use
.fullScreenCover
? Or is there another possible solution for example presenting a modal with full screen style (if there's any cause i'm not sure either).
Any suggestions will be very appreciated, thankyou in advance.
@Environment(\.presentationMode) var presentationMode
andpresentationMode.wrappedValue.dismiss()
inX
action, but it only dismiss to previous page while I want to go back to my root view. – Templeton