swiftmacosuiimagensimage

Set NSImage.image at runtime with a systemimage under MacOS


In the Interfacebuilder, NSImagebutton offers a wide range of system images to pick (see screenshot). I fail to change these images at runtime under MacOS. Under iOS there is UIImage with UIImage(systemName: "imageName") but MacOS seems to offer nothing comparable?

system images to chose from


Solution

  • It's quite similar in macOS for example

    button.image = NSImage(named: NSImage.touchBarQuickLookTemplateName)