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
This might be due to my limited knowledge of SwiftUI or a flaw in my app. However, it happens that NavigationStackView is re-initialized for rerendering and because navViewModel is created in the constructor, it forgets its state.
Marking it is a @StateObject fixes the problem for me, but this method is only available starting iOS 14, so I'm not sure if that's what you want for this library.
And as I mentioned, perhaps NavigationStackView shouldn't be reinitialized at all, but that seems to be a problem with either SwiftUI or my app.
The text was updated successfully, but these errors were encountered:
Hi @danielbuechele, sorry for the late response. In order for me to help you understanding why the NavigationStackView gets recreated I'd need to take a look at your code (at least a part of your code that can reproduce the issue). Just a question: where do you create your NavigationStackView? Usually you want to create it as the very first view of your app.
This might be due to my limited knowledge of SwiftUI or a flaw in my app. However, it happens that
NavigationStackView
is re-initialized for rerendering and becausenavViewModel
is created in the constructor, it forgets its state.Marking it is a
@StateObject
fixes the problem for me, but this method is only available starting iOS 14, so I'm not sure if that's what you want for this library.And as I mentioned, perhaps
NavigationStackView
shouldn't be reinitialized at all, but that seems to be a problem with either SwiftUI or my app.The text was updated successfully, but these errors were encountered: