UITabGroup child tabs ignoring viewControllerProvider in Sidebar

Hi,

I am implementing a sidebar navigation using UITabBarController with the new UITabGroup API on and above iPadOS 18. I’ve encountered an issue where selecting a child UITab within a group does not seem to trigger the child's own viewControllerProvider. Instead, the UITabBarController displays the ViewController associated with the parent UITabGroup.

The Issue: In the snippet below, when I tap "Item 2A" or "Item 2B" in the iPad sidebar, the app displays the emptyVC (clear background) defined in the section2Group provider, rather than the teal or cyan ViewControllers defined in the individual child tabs.

let item2A = UITab(
    title: "Item 2A",
    image: UIImage(systemName: "a.circle"),
    identifier: "tab.section2.item2a"
) { _ in
    self.createViewController(
        title: "Section 2 - Item 2A",
        color: .systemTeal,
        description: "Part of Section 2A group"
    )
}

let item2B = UITab(
    title: "Item 2B",
    image: UIImage(systemName: "b.circle"),
    identifier: "tab.section2.item2b"
) { _ in
    self.createViewController(
        title: "Section 2 - Item 2B",
        color: .systemCyan,
        description: "Part of Section 2B group"
    )
}

item2A.preferredPlacement = .sidebarOnly
item2B.preferredPlacement = .sidebarOnly

let section2Group = UITabGroup(
    title: "Section 2",
    image: UIImage(systemName: "folder.fill"),
    identifier: "tabgroup.section2",
    children: [item2A, item2B]
) { _ in
    // This provider seems to take precedence over children
    let emptyVC = UIViewController()
    emptyVC.view.backgroundColor = .clear
    return emptyVC
}

section2Group.preferredPlacement = .sidebarOnly
tabs.append(section2Group)

The Crash: If I attempt to resolve this by removing the viewControllerProvider from the UITabGroup (with the intent that only children should provide views), the application crashes at runtime. The exception indicates that all tabs within the sidebar must have an associated ViewController, suggesting that the UITabGroup requires a provider even if it is intended to act purely as a visual container.

Kindly clarify the following:

  • Is it the intended behavior for UITabGroup to override the viewControllerProvider of its children during sidebar selection?
  • Why does the API require the UITabGroup to return a ViewController if the selection target is a child UITab?
  • Is there a specific configuration or delegate method required to allow the UITabBarController to "pass through" the selection to the child tab's provider?

I would appreciate any guidance on whether this is an API limitation or if there is a different structural approach recommended for grouped sidebar items.

This is the default behavior for how UITabGroup works. To get enhanced view controller management through a UINavigationController stack, use the UITabGroup.managingNavigationController API.

There's a little more description of how that works on the following answer in another post in the forum; or check out the WWDC25 - Make your UIKit app more flexible video.

UITabGroup child tabs ignoring viewControllerProvider in Sidebar
 
 
Q