Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Best practices for using Navigator in ViewModel-heavy SwiftUI architecture? #43

@grative

Description

@grative

Hi there 👋

Thanks for this great navigation package! I’ve been exploring it and really like the simplicity and SwiftUI-first approach.

Most of the examples I’ve found demonstrate usage via the .environment(.navigator, navigator) injection, which works well in views. However, my app uses a ViewModel-driven architecture (MVVM) where navigation often needs to be triggered from the ViewModel (e.g., after a network call, authentication success, etc).

I’d love to understand the best practices for using Navigator in a ViewModel-heavy setup:

Is there an officially recommended way to expose or pass the navigator to ViewModels?

If there are any examples, discussions, or design thoughts around this use case, I’d be really grateful for a pointer 🙏

Thanks again for your work on this library!

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