Change of EnvironmentObject (ObservableObject) pops current view

Hello there,

Since the new iOS 15 update, I have a navigation problem in my app.

The following situation happens: I have a ContentView, which is pretty much the start of the app after SceneDelegate. In this ContentView, I have two more views: A BottomNavigationView (UIKitTabView) and a View which holds overlay views, let's call it OverlayViews. This OverlayViews for example contains views like showing Premium Membership Screen or a full Loading View. They are also just normal Views. So the hierarchy is the following (not real code, just some pseudo to show the state):

@EnvironmentObject var eo: CustomEnvironment

ContentView {

    BottomNavigationView().environmentObject(eo) {
        NavigationView {
            TabView1().environmentObject(eo)
        }
        ....
    }

    OverlayViews().environmentObject(eo) {
        if(eo.showPremium) {
            PremiumScreen()
        }
        ....
    }

}

I control the views in OverlayViews by an EnvironmentObject. So, if I say in some child view deep down in the NavigationView of a BottomNavigationView Tab to show a Loading Screen which lays over the whole screen, I say like environemtObject.showOverlayView() and the Object sets some variable to true. This variable then triggers the loading screen to show.

This worked perfectly fine, until now. Since the update to iOS 15, accessing the EnvironmentObject in a child view and changing it causes the NavigationView to pop the last child. So if I have the actions: View1, View2, View3, View4, showLoadingScreen in environmentObject, pops View4, shows loading screen

I want this behavior: View1, View2, View3, View4, showLoadingScreen in environmentObject, shows loading screen

Did they change something with the EnvironmentObjects/ObservableObjects? It seems like the change of the Object update triggers to show the view where the change of the view actually happens. If so, how can I avoid this behavior? Are there any suggestions?

Thank you!

Best, Markus

Can you show a complete code to reproduce the issue?

Change of EnvironmentObject (ObservableObject) pops current view
 
 
Q