UITabBarController didSelect item not working on iOS 18

I have been using the following function in my UITabBarController for several years, which runs some code when the user clicks a tab. I have now built the app using Xcode 16 and when I run it on my iPad with iPadOS 18, the function is not called. When I run the same app on iPadOS 16, it works just fine like it always has.

Is this a bug, or is there something new that I need to do for iOS 18 support?

override func tabBar(_tabBar: UITabBar, didSelect item: UITabBarItem) { 
    // Some code
}

NOTE: My UITabBarController is presented from my root view controller, which is a UINavigationController.

Answered by Frameworks Engineer in 805556022

If your subclassing UITabBarController, we'd recommend you instead use its own delegate instead, especially since in cases where you have the new tab bar UI those old UITabBarDelegate methods are not called (as there is no UITabBar)

The signature for the delegate method has likely changed to support swift concurrency. That sort of issue has broken a lot of our app's screens,

Accepted Answer

If your subclassing UITabBarController, we'd recommend you instead use its own delegate instead, especially since in cases where you have the new tab bar UI those old UITabBarDelegate methods are not called (as there is no UITabBar)

UITabBarController didSelect item not working on iOS 18
 
 
Q