GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

NavigationView and TabViews

Forums > SwiftUI

Hello all,

I am struggling with mixing navigationViews and tabs for my app.

Allow me to describe the flow:

  1. App launch shows a list of files that the user can select to open. This is a navigationView with List embedding NavigationLinks
  2. When user selects the file name, he/she is navigated to a Tab with 4 Tabs (Dashboard, CategoriesView, TransactionListView, Settings)
  3. Tabs for Dashboard, CategoriesView & TransactionsListView all require a Master/Detail type view, thus are NavigationViews with NavigationLinks.

While all of the navigation works as expected, the problems are:

  1. Missing NavigationTitles in the TabView's. Have tried both inline and regular NavigationTitles. Both dont show up
  2. Another bar is added where the toolbar buttons are displayed. I am trying to add the toolbar buttons to the first navigation bar above.
  3. when Navigating to the next level, another back button is being added (resulting in 3 bars - one each from each level of NagivationView)

Screenshots here

https://imgur.com/gallery/mixing-navigationviews-tabviews-iUvDZEK

Thanks

   

The issue is that you have a NavigationStack -> TabView -> NavigationStack.

A TabView need to be the firstand always visable. TabView -> NavigationStack. You can have a .fullScreenCover that will cover the TabView which might work.

You might want to rethink the flow of the app.

   

@NigelGee, thanks for the suggestion, I am reconsidering the flow and thinking that when the app launches I display a sheet for the user to select Journal and then TabView can be the first view. let me try and report back in the next day or so if that solves the problem.

Cheers

   

Hacking with Swift is sponsored by Alex.

SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!

Try for free!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.