You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For normal Navigation SwiftUI it's possible to dismiss view and still see old data on this view (TextFields etc.)
@Environment(\.presentationMode) var presentationMode
Button { presentationMode.wrappedValue.dismiss() } label: {
For NavigationStack it looks like the view is completely reloaded / restarted / recreated from scratch.
Pop method is not working like a dismiss one. Dismiss method from official SwiftUI is not working at all for NavigationStack views.
Is there any possibility to achieve this kind of behavior?
The text was updated successfully, but these errors were encountered:
Ok, I found out that this Issue is described with a workaround on the main page. I missed it. We can close this issue or even delete it if it's possible.
Issues
" SwiftUI resets all the properties of a view marked with @State every time the view is removed from a view hierarchy. For the NavigationStackView this is a problem because when I come back to a previous view (with a pop operation) I want all my view controls to be as I left them before (for example I want my TextFields to contain the text I previously typed in). In order to workaround this problem you have to use @observableobject when you need to make some state persist between push/pop operations. For example:
"
Hello,
For normal Navigation SwiftUI it's possible to dismiss view and still see old data on this view (TextFields etc.)
For NavigationStack it looks like the view is completely reloaded / restarted / recreated from scratch.
Pop method is not working like a dismiss one. Dismiss method from official SwiftUI is not working at all for NavigationStack views.
Is there any possibility to achieve this kind of behavior?
The text was updated successfully, but these errors were encountered: