I have converted an image from PNG to SVG using the vectorizer.io website. The SVG image looks fine when viewed with the Chrome browser and in GIMP. But when I try to add it to the asset folder in xcode (Version 11.4.1) I get this error ...
The SVG file provided for the symbol image set X is not suitable. Symbol image file (null) must have a glyph for regular weight Medium image size.
I have tried opening the file with Inkscape and saving it as various versions of the SVG and PDF, but none seem to be acceptable.
I have not been able work out how to provide that glyph, and whether this is a fault in the SVG file or something I have failed to do in xcode.
Updates from Apple's 2020 WWDC Conference revealed that Xcode 12 will now support the SVG (Scalable Vector Graphics) file format. SVGs are a format of vector graphics known to be smaller files than other vector graphics formats, and as their name implies SVGs scale well.
For using SVG, you only need to drag them in your assets folder and then you can use them in your project file by using UIImage class named constructor.
Perhaps the most fundamental difference between PNG and SVG is that one is a raster file type and the other is vector. A PNG is a raster — that is, pixel-based — image format. If you scale up a raster image too far, it becomes grainy and pixelated. Similarly, if the image is too small, it can become indistinct.
As mentioned in the beginning, SVG file is widely used to display graphics in Browser, which means it is web browser-friendly and you will be able to open SVG files in Mac browser, like Safari.
Only starting from Xcode 12 you can use SVG.
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