-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SwiftUIRouter using NavigationLink #43
Comments
The goal of SwiftUI Router was to provide an alternative to SwiftUI's Both follow a different ideology: with SwiftUI Router, on the other hand, uses a global state (the path) and maintains it, removing the burden from the user. The user also isn't required to define the destination view in advance when using Having SwiftUI Router support |
@koraykoska @frzi While this makes sense, I'd have to disagree. Most if not all iOS apps use navigation of some kind, and if you decide to use this library, you'd need to completely build your own navigation bars and animations that you'd normally get for free. Especially if you are trying to adhere to Apple's Human Interface standards, out-of-the-box SwiftUI components will include the correct font sizing, typography, spacing, animations, etc. I was about to open a RFC for the sheet/navigation support I added to my fork of this library when I found this issue. The only problem with my approach is you'd need to add a custom back button to your views that would call Here are my changes: All this adds is a |
Thanks for the example. The issue with the Currently I have no plans for SwiftUI Router as-is to work hand-in-hand with I agree that it's a worthy feature to explore. But this would be better left for a SwiftUI Router 2.0, with a (major?) overhaul in its API. A great opportunity to explore ways to better integrate Examples of a 2.0 could be:
To me adding support for I'm keeping this issue open - or may turn it into a discussion, as I think it's important to keep this all in mind for future developments of SwiftUI Router. Even if I've been pretty absent from the SwiftUI scene lately 😅 |
Hey @frzi! Thanks so much for the detailed response. I actually did almost create a separate component, but didn't want to duplicate a bunch of logic 😂. I have a proposal, in that case: the biggest reason I forked this repo and suggested an upstream change to the API is the fact that the logic that actually performs path matching is internal to the route component. I would have just as soon created a I previously had a Do you think it'd be possible to generalize the internal logic of the route matching and expose it? Then we could append the README to include an example of how you could leverage the path matching to push views via Perhaps creating a wrapper component such as Alternatively, at a bare minimum, maybe just make the current |
Hm I wonder whether making the Will have to give this a proper think. It's times like these I wish Swift had something like abstract classes/structs 😛 |
@Nickersoft did you continue with this? I'm beginning a project now and like your ideas for this but don't know what else to use meanwhile |
We are using this library since starting the development of our app. It grew quite big and we start having smaller annoying issues that would not exist if it was for the standard NavigationLink.
I had to think about how a path-based routing approach could work with the standard NavigationLink in SwiftUI and there are a lot of things to consider, of course.
Now, before I go ahead and try to open a PR that allows using NavigationLink (optionally, or even make it generic and allow custom implementations of navigators?), I wanted to ask whether someone has experience with that.
Especially @frzi . Is there a reason why you opted for a custom implementation other than convenience? Did you try and see some problems or do you know what I should focus on when trying?
The text was updated successfully, but these errors were encountered: