frzi / swiftui-router

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

Able to switch to another tab then push to a certain view under navigation view then finally present a modal? #57

Open liangwangcm opened 2 years ago

liangwangcm commented 2 years ago

My requirement is: Switch to another tab then push to a certain view under navigation view then finally present a modal?

How can I config routing for this case?

Thanks

frzi commented 2 years ago

SwiftUI Router does not play nicely with NavigationView. Instead, it's meant as a replacement for NavigationView.

For an example how to use SwiftUI Router with the TabView, there's the TabView example in SwiftUIRouter-Examples. The same logical can also be applied to presenting modals.

If NavigationView is a must for your project, I would personally recommend switching over to the new NavigationStack introduced in iOS 16 at WWDC22.