Currently I am working on making my app ready for iOS 26, and noticed an issue with a UIBarButtonItem(customView:) as a leftBarButtonItem. I want to disable the glass effect.
The glass effect needs to be disabled because UIBarButtonItem has no interaction (attached to it). The customView is just a simple UIImageView containing a logo. What is the best way to go about this?
I already watched the Build a UIKit app with the new design, and Build an AppKit app with the new design. Were the latter hints about the NSToolbarItem.isBordered. Which is exactly what I am looking for, but then the equal in UIKit.
Edit: I am aware of the UIDesignRequiresCompatibility plist key. I am talking about making it work in iOS 26 with glass design.
If you're still looking for an answer, I think I have a solution for this assuming you had the same problem as me:
Set .sharedBackgroundVisibility(.hidden) on the ToolbarItem
Set .hidesSharedBackground = true on the UIBarButtonItem
//
// SwiftUI
ToolbarItem(placement: .primaryAction) {
Button {
...
} label: {
...
}
}
.sharedBackgroundVisibility(.hidden) // 👈 here
//
// UIKit
navigationItem.rightBarButtonItem = UserHubBarButtonItem(user: user)
if #available(iOS 26.0, *) {
navigationItem.rightBarButtonItem?.hidesSharedBackground = true // 👈 here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With