frzi / swiftui-router

Path-based routing in SwiftUI
MIT License
900 stars 43 forks source link

Is there any way to animate transitions? #6

Closed joaquinperezlopez closed 4 years ago

joaquinperezlopez commented 4 years ago

Hi, first of all, congrats about this library, it is very useful.

I wonder whether there is a way to animate switch route changes like the old-styled UIKit NavigationView actually does. Maybe there is a easy way to do it, but I didn't find it.

Thanks in advance

frzi commented 4 years ago

Thanks for your comment!

In the earlier versions of SwiftUI Router it was possible to animate the transitions by adding the .animation() view modifier to a Route or even a Switch. But since a restructuring of the code it seems that ability was lost. From that point on I never really managed to get animations to behave correctly. (or at all in some cases)

This project always was merely a proof-of-concept to see if navigation in SwiftUI could be made as simple as React Router. While still respecting a very SwiftUI-esque API. There's so much room for improvement, however.

At this point I'm currently waiting for WWDC'20 to see what the inevitable Swift UI 2 will bring to the table, before refactoring the project. (Secretly I'm hoping Apple will develop their own routing solution 😉)

joaquinperezlopez commented 4 years ago

Thank you so much for the info, I appreciate it, let's hope SwiftUI 2.0 brings new tools to make this possible, I came from React environment and React-Router styled navigation could be awesome in SwiftUI.

You can close the issue whenever you want, have a good day!

amadeu01 commented 4 years ago

@frzi are you thinking about continuing with this project? and so, the animation transitions? I don't think swiftui 2.0 has any support for router so far.

frzi commented 4 years ago

No plans at the moment, unfortunately. Usually I expand/improve on these projects when I actually use them for production. If I were to continue with SwiftUI Router I'd probably start over from scratch. 😅