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

FlowUI. SimpleUITesting.com picture FlowUI. SimpleUITesting.com · Jun 10, 2019 · Viewed 11k times · Source

I have this

Image(systemName: "arrow.right")

But how do i make it bold, semibold etc?

I am using the new SwiftUI.

Answer

EmilioPelaez picture EmilioPelaez · Jun 10, 2019

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))