I am updating my existing UIKit to use SwiftUI in some parts where I feel comfortable about being able to replace all of it with SwiftUI. It is a tab application, so there are 3 tabs and one of it are Settings, which I am replacing with SwiftUI. My tab bar is configured to only show images and no titles (the issue I need help with would also occur with labels shown). Now in UIKit I do this:
private let settingsViewController: UIViewController = UIHostingController<SettingsView>(SettingsView())
and later on before showing it:
settingsViewController.navigationItem.title = "Settings".
However from then on SwiftUI takes on with its view modifier: .navigationBarTitle("Text"), which I use for nested view controllers (pushed via NavigationLink), as UIKit cannot access those views to set a title.
The issue is however, that whenever .navigationBarTitle is used (same with setting the view's title property in UIKit, it sets the current tab bar items title. For UIKit there is always a way to set the navigationItem.title instead of title.
Is there any way to set the navigation bar title but not the tab bar title itself in SwiftUI?
Thanks