Search code examples
iosswiftswiftuisf-symbols

How do I set a weight to SF Symbols for iOS 13?


I have this

Image(systemName: "arrow.right")

But how do I make it bold, semibold etc?

I am using the new SwiftUI.


Solution

  • When using the font modifier, set a weight to the font you're passing.

    For example, if you want to use one of the default text styles (which I recommend, since they adapt to the user's Dynamic Type setting), you can do it like this:

    Image(systemName: "arrow.right")
      .font(Font.title.weight(.ultraLight))
    

    If you want to specify a font size, you can do it like this:

    Image(systemName: "arrow.right")
      .font(Font.system(size: 60, weight: .ultraLight))