matteopuc / swiftui-navigation-stack

An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations and programmatic navigation.
MIT License
930 stars 87 forks source link

Programmatically navigation does not work on simulator or physical device with iOS 14.5 #54

Open vegiwoo opened 3 years ago

vegiwoo commented 3 years ago

On a simulator with iOS 13.0, programmatically navigation works fine, but on the same simulator with iOS 14.5 and on a physical device with iOS 14.5, the transition does not work. With what it can be connected?

// First View
@EnvironmentObject var navigationStack: NavigationStack
//...
DispatchQueue.main.async {
    let destination = ModelDetailContainerView()
        .environmentObject(appStore)
        .environmentObject(navigationStack)
    self.navigationStack.push(destination)
}

// Second View
@EnvironmentObject var navigationStack: NavigationStack

var body: some View {
    ModelDetailRenderView(item: detailedSelectedItem)
        .valueChanged(value: detailedSelectedItem.wrappedValue) { value in
            if value == nil {
                navigationStack.pop(to: .root)
            }
        }
}

UPD Transition occurs by tap on the context menu item of custom cell. Programmatic behavior of all interested entities does not change depending on iOS version.