I failed to resize the icon image from instances of NSRunningApplication. I can only get 32×32 while I'm expecting 16×16.
I felt it unintuitive in first minutes… Then I figured out that macOS menu seems not allowing many UI customizations (for stability?), especially in SwiftUI.
What would be my best solution in SwiftUI? Must I write some boilerplate SwiftUI-AppKit bridging?
Sorry I just forgot about copying the NSImage instance. I didn't see performance issue loading about 50 resized images into menus in my workspace. Solved.
let nsImage = {
let returnValue = icon.copy() as! NSImage
nsImage.size = CGSize(width: 16, height: 16)
return nsImage
}()
Image(nsImage: nsImage)