I have a simple test app with a list of items in a NavigationView List. When one is clicked, it fills in the data in a detail view called by a NavigationLink.
If the app goes to the background, or the sidebar is completely collapsed, the detail view disappears. I see that it calls the view's onDisppear modifier.
This does not happen with macOS Catalina but happens with Big Sur when using Xcode 12 with the new SwiftUI App lifecycle or Xcode 11 with the old UIKit life cycle.
I have tried creating a state object that stores the selection, binding the selection in the NavigationLink and lots of other options, but I cannot work out how to persist the detail view.
The Fruta sample app does this fine, but there is so much else going on there, that I cannot work out what bit is making this work.
Any ideas?
If the app goes to the background, or the sidebar is completely collapsed, the detail view disappears. I see that it calls the view's onDisppear modifier.
This does not happen with macOS Catalina but happens with Big Sur when using Xcode 12 with the new SwiftUI App lifecycle or Xcode 11 with the old UIKit life cycle.
I have tried creating a state object that stores the selection, binding the selection in the NavigationLink and lots of other options, but I cannot work out how to persist the detail view.
The Fruta sample app does this fine, but there is so much else going on there, that I cannot work out what bit is making this work.
Any ideas?