0

I am trying to understand how to organize my app. Below you can find how I want my app to be organize

Question : How to go back from DetailView to HomeView and "re-initialize" navigation ?

AppOrganize

My Actual code to go back to First Screen

  var body: some View {
        VStack{
        NavigationLink(destination: HomeView(), tag: 1, selection: $action){}
        HStack{
            Button(action: {
                self.action = 1
            },label: {
                Text("Home")
            })
        }.padding()

HomeView :

 var body: some View {
    NavigationView{
        VStack{
            NavigationLink(destination: ParamsView()){Text("Settings")}

If I navigate to : HomeView > ParamsView > GeneralView > Tab1 > Detail > Home Button And do it multiple times here is the result :

MultipleNavigation

Clément Tengip
  • 618
  • 6
  • 19
  • Does this answer your question https://stackoverflow.com/questions/57334455/swiftui-how-to-pop-to-root-view? – Asperi Nov 15 '20 at 11:35
  • I am already trying to solve it with this question. But I can't find how to pass my NavigationLink : NavigationLink(destination: getDestination(), tag: 1, selection: $action){} to this one : NavigationLink(destination: getDestination(), isActive: self.$isActive, tag: 1, selection: $action ) {} When I click on button, self.action = 1 then navigation link activate isActive and tag/Action do not seems to be working together – Clément Tengip Nov 15 '20 at 11:48

0 Answers0