This is a really weird issue that I haven't been able to resolve.
It happens only on iOS 15 and only the 1st time I try to open this specific NavigationLink.
I have 3 SwiftUI Views:
- ContentView (entry point)
- DetailView
- ItemView
ContentView is a list of DetailViews and in detail views there can be any amount if ItemViews.
I have an ObservableObject with a Published
property count
, that is only accessed from ContentView. In ItemView I have function that's triggered by onAppear
, that updates count
in the ObservedObject.
When I open an ItemView for the first time after opening the App, it moves to the view but immediately goes back to DetailView. It doesn't happen, when I open it again, even though count
is updated again.
I have spent a lot of time debugging this issue, but I'm out of ideas. I have tried reproducing it in a Swift Playground, but everything I've tried there seems to work as expected.
I hope someone has an idea on how I can resolve this issue, I would be most grateful!