When adding custom NSToolbarItem using NSToolbarDelegate I can't set the image of the icons. The problem comes when using default ones (SplitView or Share), which have a different size:
Here's the example code for two of the items, one is the share one and the other is to add a new item. Please also note that in the share example I'm using NSSharingServicePickerToolbarItem and even I'm overriding the image it's still using the 'system' one.
case .new:
let item = NSToolbarItem(itemIdentifier: itemIdentifier)
item.image = UIImage(systemName: "plus")
item.label = "New Card"
item.action = #selector(ViewController.didTapCreateNewToolbarButton(_:))
item.target = nil
toolbarItem = item
case .share:
let item = NSSharingServicePickerToolbarItem(itemIdentifier: itemIdentifier)
item.image = UIImage(systemName: "square.and.arrow.up")
item.label = "Share"
item.action = #selector(ViewController.didTapShareToolbarButton(_:))
item.target = nil
toolbarItem = item
I've tried using UIImage.SymbolConfiguration(pointSize: 8, weight: .medium) but the result is the same.
I've also tried this solution: https://developer.apple.com/forums/thread/131364 but the result is an image taking the whole space available (bigger and pixelated).
So, how can I change the size/styles of those buttons? Would be great to be able to change both the system and my custom ones.
EDIT 1: This issue only appears when removing the title, which makes the toolbar more small in height and resizes properly the system buttons but not the other ones:
if let titlebar = windowScene.titlebar {
titlebar.toolbar = toolbar
titlebar.toolbarStyle = .automatic
titlebar.titleVisibility = .hidden // <-- THIS
}

