How to use Tab along with NavigationStack

Apple introduced Tab in iOS 18. Using the latest TabView APIs developer can add tab bar and side bar. However I need to control the navigation programmatically. For this I would add NavigationStack for each Tab. Would tab be a good practice? Or you have any other optimal solution?

Answered by Vision Pro Engineer in 790260022

Hi @zoha131 ,

Yep, a NavigationStack should be added to each tab. That's the best practice since then each tab has its own stack.

If you haven't yet seen it, there's a WWDC24 talk on the new tab bar here: https://developer.apple.com/videos/play/wwdc2024/10147/

Accepted Answer

Hi @zoha131 ,

Yep, a NavigationStack should be added to each tab. That's the best practice since then each tab has its own stack.

If you haven't yet seen it, there's a WWDC24 talk on the new tab bar here: https://developer.apple.com/videos/play/wwdc2024/10147/

How to use Tab along with NavigationStack
 
 
Q