When composing tabs like this and selecting them in the sidebar, only the group's view controller is ever displayed, even when selecting the individual first and second tabs. Their view controllers are just ignored. Am I immensely stupid here or is this a bug in iPadOS 26 beta 3?
// First tab
let firstTab = UITab(
title: "First",
image: UIImage(systemName: "heart"),
identifier: "hello"
) { _ in
UINavigationController(rootViewController: ViewController())
}
// Second tab
let secondTab = UITab(
title: "Second",
image: UIImage(systemName: "heart"),
identifier: "hello2"
) { _ in
UIViewController()
}
// Tab group
let tabGroup = UITabGroup(
title: "Stuff",
image: nil,
identifier: "stuff",
children: [firstTab, secondTab]
) { _ in
ViewController()
}
let tbc = UITabBarController(tabs: [tabGroup])
tbc.mode = .tabSidebar
By default, UITabBarController will only change the view controller for root tabs. Apps can manage how the view controller hierarchy changes within that root tab through system callbacks from UITabBarControllerDelegate.
Setting managingNavigationController
on UITabGroup
will opt-in the specified group to allow UITabBarController
to automatically manage its hierarchy for you.
See this forum comment which has a deeper explanation on how managingNavigationController
works, and how you can customize the stack that is built in.
You can also watch Make your UIKit app more flexible from WWDC25 which also explains how this API works with examples.