1

I like to use build-in icons for my buttons in SwiftUI, including a rectangle around the image. Simply like an ordinary button with a system icon.

But how can I use them? I can copy them as independend graphics in my project and then use

Image("MyIconName")

but I like to access them without making individual copy, like

Image( NSImage(NSImageNamePathTemplate) )

Any idea?

BTW: This does not belong to not support iOS icons, because NSImage offers these directly in macOS.

Peter71
  • 2,180
  • 4
  • 20
  • 33
  • Does this answer your question? [SwiftUI on macOS, how to use custom image symbol on Button?](https://stackoverflow.com/questions/61271693/swiftui-on-macos-how-to-use-custom-image-symbol-on-button) – NikzJon May 01 '20 at 22:41
  • I will check it, as soon as I'm able to implement this in my current project. – Peter71 May 02 '20 at 15:50
  • Yes, it works fine! Thank you! – Peter71 May 02 '20 at 17:16

1 Answers1

2

Here it is

Image(nsImage: NSImage(named: NSImage.pathTemplateName)!)
Asperi
  • 228,894
  • 20
  • 464
  • 690