You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I don't think SwiftUI is ready for this kind of navigation yet. Navigation is controlled by stated, but it has only 2 states... may be we need more? Somehow there is a missing state for performing the action, etc. I would like some interface like withAnimation...
Also it would be awesome if it would work for closing too.
I think for now, you can use workaround:
Button("Navigate To Detail"){
levels =[true, false]// slow down due to the opening of the first screenDispatchQueue.main.asyncAfter(deadline:.now()+ 0.5){
levels =[true, true]}}
Code with changes:
import SwiftUI
structDetailView:View{@BindingvarshowDetail:Boolvarbody:someView{List{NavigationLink("detail", isActive: $showDetail){Text("Detail")}}}}structMyList:View{@Bindingvarlevels:[Bool]varbody:someView{List{NavigationLink("Detail", isActive:$levels[0]){DetailView(showDetail:$levels[1])}}.overlay(Button("Navigate To Detail"){
levels =[true, false]// slow down due to the opening of the first screenDispatchQueue.main.asyncAfter(deadline:.now()+ 0.5){
levels =[true, true]}})}}structContentView:View{@Statevarlevels=[false, false]varbody:someView{NavigationView{MyList(levels: $levels)}.navigationViewStyle(.stack).overlay(Text(levels.map{ $0 ? "t":"f"}.joined()), alignment:.bottom)}}
I don't think SwiftUI is ready for this kind of navigation yet. Navigation is controlled by stated, but it has only 2 states... may be we need more? Somehow there is a missing state for performing the action, etc. I would like some interface like withAnimation...
Also it would be awesome if it would work for closing too.
I think for now, you can use workaround:
Code with changes: