New 'badge' property of UIBarButtonItem does not work in iOS 26 beta 3 when used in a toolbar

I'm very happy with the new badge property of UIBarButtonItem, but unfortunately it doesn't work yet on a UIToolbar object.

The following code does change the tint color of the button to pink, which proves the button object exists, but there is no visible badge after running the code:

if let button = toolbarItems?.first {
    button.badge = .count(123) // Does nothing
    button.tintColor = .systemPink // Works
}

Do I overlook something, or is this just not implemented yet? Or is this limitation 'by design'? (That would be a MAJOR disappointment)

@elemans I agree this is a great new feature, though my observations are a bit different

Setting the badge value with .count() or .string() works for me, but I did have some struggles with colors. I believe setting the .badge property to some non-nil value early on in the UIBarButtonItem lifecycle seemed to help.

For example, this code in a UIViewControllers viewDidLoad did produce a cyan on black badge with value 123:

self.buttonHistory = UIBarButtonItem.init(image: ...)

if #available(iOS 26.0, *) {
  self.buttonHistory.badge = .count(123)
  self.buttonHistory.badge?.backgroundColor = .black
  self.buttonHistory.badge?.foregroundColor = .cyan
}
self.navigationItem.rightBarButtonItem = buttonHistory

and I found that as long as the .badge property is initialized early on to a non-nil value, like shown above (even initializing to .none), then I could subsequently change its value, background, and foreground colors.

In my case the UIBarButtonItem is in a UINavigationBar not a UIToolbar, not sure if this makes a difference.

Thanks for your reply! My question concerns only the UIToolbar. It works indeed as expected in a UINavigationBar. So Apple don't want us to use badges in the UIToolbar for whatever reason or it is a bug.

New 'badge' property of UIBarButtonItem does not work in iOS 26 beta 3 when used in a toolbar
 
 
Q