Home > Enterprise >  How do I use an SF Symbol in Swift using its symbol literal instead of its name?
How do I use an SF Symbol in Swift using its symbol literal instead of its name?

Time:07-15

The normal way to use an SF Symbol is to find the image you want in the SF Symbols app, copy its name, and then use this name in the Image(systemName:) constructor. For example, if I'd like to display the share Icon, I could use the following code:

Image(systemName: "square.and.arrow.up")

This will produce the following image in the UI:

enter image description here

This is great, but just like enter image description here

If I try using that code, though, I get the following error:

enter image description here

No symbol named '

  • Related