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:
Here is the symbol imported as a 3.0 template in the 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:
How do I get the hierarchical shading?
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:
Bottom line: Export as a symbol, not as a template when importing into Xcode.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.