Has anyone figured out how to create customized SF-Symbols using the techniques outlined in the WWDC video, the only existing documentation that I can find on the subject? According to the video one can simply edit the exported SVG file and reimport it as a symbol set.
And while this does work for minor edits, I'm finding it very difficult to produce a working customized symbol file with more than a minor edit. The errors and/or bugs produced are numerous and I've tried many things to produce an acceptable file (removing strokes, converting to shapes, etc). Most imported files produce an error similar to:
The SVG file provided for the symbol image set ’doc.test3‘ is not suitable: Symbol image file '(null)' has glyph node Regular-M that is not a group got type:'2' expected:'1'"
Does anyone have any suggestions? I don't have a specific project goal here. I'm simply trying to learn the appropriate way to create a custom symbol in the absence of any documentation.
Using a custom symbol in your app is incredibly easy. Switch to Xcode and select the main asset catalog, Assets. xcassets, in the Project navigator on the left. Switch to Finder and drag your new SF Symbol into the asset catalog.
If you use SF Symbols in SwiftUI's Image view, you can get simple colors using the foregroundColor() attribute, or enable their multicolor variants by using . renderingMode(. original) .
SF Symbols can also be exported from the application, simply select the symbol you want to export and from the top menu, select File > Export Custom Symbol Template… or type ⌘E. With this, we will obtain the icon in SVG format.
The overview documentation suggests that one take an existing symbol file and open it in Sketch or some other SVG editor. Specifically the documentation on creating a new symbol gives a bit of a walkthrough. I believe the workflow will be something like this...
Shape
Shape
layer substitute (copy/paste) a comparable shape/path from the set of shapes/paths on a layer from your new imageNote - As part of my test, I noted that although the header of the SVG was different when I exported the symbol file from Sketch when I added the file to Xcode (drag/drop), the new symbols did appear.
Also, the font used in the edited File defaulted to Helvetica instead of the new SF font in the original exported SF Symbol file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With