0

in my simple app written in SwiftUI I have a root view and X number of generic views. From Root view I go to View A -> from A to B -> From B to C. When I confirm in C, views A,B,C are popped out like this solution link . From root to C I pass a variable. When C is closed this variable is not empty. My problem is: when I come back from C to root I should automatically go from root to view D if my var is valorized. Ho can do this? I've tried to check the var value in onappear func of root view using navigationLink

NavigationLink(destination: D(), tag: Constant.SelectionConst.D_SELECTED, selection: $action) {
        EmptyView()
    } 

    .onAppear(){
        
                action = Constant.SelectionConst.D_SELECTED
               
            }
        }

The result is: when from C come back to root automatically goess to views D, after 1 second come back automatically to root. Any suggestions? Thanks

0 Answers0