Skip to content

navViewModel not persisted #33

Closed
Closed
@danielbuechele

Description

@danielbuechele

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions