0

I have a custom SF Symbol that renders with hierarchical shading when viewed in the SF Symbols 3 app, but in iOS using SwiftUI it renders as monochrome.

Here is the symbol in the SF Symbols 3 app:

custom symbol in SF Symbols 3 app showing layers

Here is the symbol imported as a 3.0 template in the asset catalog:

symbol in asset catalog

Here is the code to render it:

  Image("custom.figure.steps")
    .font(.largeTitle)
    .padding(.trailing)
    .symbolRenderingMode(.hierarchical)
    .foregroundColor(status.statusColor)

Here is how it renders in iOS simulator:

custom symbol as rendered in iOS

How do I get the hierarchical shading?

Chuck Krutsinger
  • 2,830
  • 4
  • 28
  • 50

1 Answers1

0

Ok, discovered my mistake. I exported as a template, which did not preserve the layers. When I exported as a symbol 3.0, the layers were preserved and now things are rendering as expected.

How I diagnosed:

  • imported the SVG that I had exported as a template back into SF Symbols and noticed that only a single layer was there
  • exported as a symbol and imported that into Xcode, rendered as hierarchical

Bottom line: Export as a symbol, not as a template when importing into Xcode.

Chuck Krutsinger
  • 2,830
  • 4
  • 28
  • 50