Detached view controller while routing to alert #19
Replies: 2 comments
-
|
@OrangeWatch This would seem to be a SwiftUI limitation, of which there are many when it comes to navigation, unfortunately. We've reported a bunch of feedback to Apple for various navigation issues, and we hope that some are solved this coming WWDC. Our recommendation would be to try to reproduce the issue in vanilla SwiftUI (that is, without our library obscuring anything) and then report that as feedback to Apple. If you have trouble reproducing in SwiftUI, let us know here 😄 |
Beta Was this translation helpful? Give feedback.
-
|
I think the issue is you have the I had a similar issue with a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I encountered problems with routing. Change of route can lead to inconsistent state in some scenarios.
I prepared example to demonstrate the issue. There are two possible routes for
ContentView. InContentViewModelI simulate start of the app with given route (navigationLinkcase). After some time is route programatically changed (alertcase). Here is example code:The problem is with switching route to
alertwhennavigationLinkroute is active. Becausealertis being presented onnavigationLinkthat is meanwhile being popped, I get this error:This basically leads to inconsistency of state, because result of this situation is that:
route== nilThis was only the simplest situation possible but it seems that it can cause a lot of problems in more complex apps (e.g. presenting alerts on different tabs).
Did you encounter this kind of issue? Maybe this is not the proper way of routes usage?
Thank you for your thoughts! I appreciate your work 💪
Beta Was this translation helpful? Give feedback.
All reactions