SVG image XCode support or not…?
Xcode 12 has introduced Scalable Vector Graphic (SVG) image asset support support for iOS, macOS, and iPadOS. It is one of those changes that you may miss during WWDC 2020.
Until Xcode 12, we were able to use single-scale resources using PDF objects. Eliminates the need to create individual images on each scale using @ 1x, @ 2x, and @ 3x postfix. This saves time and eliminates potential mistakes such as by accidentally copying @ 3x goods to @ 1x image size (we all did just that, right?)
According Apple
As per Apple developer It’s not support SVG image.
https://developer.apple.com/forums/thread/72838
According to stack-overflow after convert svg to pdf you can use svg image. (we also convert direct png 😉).
https://stackoverflow.com/questions/43721020/loading-svg-based-image-assets-for-ios-app
What is SVG….?
Scalable Vector Graphics, also known as SVG, defines two-dimensional graphics defined in Extensible Markup Language (XML). It’s mostly used for icons and symbols and allows platforms to scale up the asset for the current active resolution.
Supported Platforms
It’s important to point out that SVGs are only supported on macOS 10.15 or later, iOS 13 or later, and iPadOS or later. If your app supports any older version you should not use single scale SVGs.
Apple gives support but why we not use 🤔
SVG image take longer time compare png in large scale.
Its programatically XML file chance to file corrupt.
some time apple reject application due to not clear size image.
you use iOS 13 or latest only support. If you gives then also provide png as well.
Before you start replacing all your assets with SVGs you might want to consider using SFSymbols instead.
SFSymbols have the same platform version availability and are available as system images. This takes away some extra space in your app bundle.
single image add thats work universal.
Yes, Some advantage 😀 (But it’s very little)
single image add thats work universal.
setup was traditional like other image we set in Assets.
Yes I know you want to know How can I use an SVG in Xcode? Let’s start hurry 🏃♂️.
Using SVGs in Xcode is simple. Open your asset in Xcode. You simply drag the file into your Assets Catalog after which you have to change the Scales option to “Single Scale”.
Now It’s time to open storyboard.
Conclusion
SVG support is a good addition to Xcode 12 during WWDC 2020. Allows single scale assets with very small resource file. SVGs do not always have the right choice as they are only supported from iOS 13 and later, iPadOS 13 and later, and macOS 10.15 and beyond. In that case you can go back to using PDFs instead.
Further Reading
If you like to improve your Xcode knowledge, even more, Get notified about the details of New innovation in software industry, as well as other important development update & expansion of IT industry check our previous & Upcoming article. if you have any additional tips or feedback.