Loading SVG based image assets for iOS app Loading SVG based image assets for iOS app ios ios

Loading SVG based image assets for iOS app


No, it's not the optimal solution.

Your current solution works, of course, but it's far from ideal. You are losing (precious!) image quality in doing so (see here for more details). You can improve your worklflow by:

  • exporting all 3 resolutions from the original SVG file, ensuring you get the best possible PNG bitmap from a vector based image source (using Gapplin or some other image app);

  • or converting your SVG to PDF and then importing the PDF vector image file in Xcode (last time I checked, Xcode 8 still didn't have direct support for SVG files so we are stuck with good old PDF for now).

Both methods, image quality wise, should produce very similar results and are an improvement from your current workflow.

Regarding app file size, you shouldn't again see a difference from neither method. Even using the last method, Xcode still generates the required assets at build time and, as such, your app will be carrying around the same image/icon set as the first method.


I know this answer comes long after the question. But as of Xcode 12, and using deployment targets of macOS 10.15 or later, iOS 13 or later, and iPadOS 13 or later, you should be able to use an SVG image directly in your asset catalog. From the Xcode 12 release notes:

Asset Catalogs
New Features

  • Added support for Scalable Vector Graphic (SVG) image assets. These preserve their vector representation with deployment targets of macOS10.15 or later, iOS 13 or later, and iPadOS 13 or later. (18389814)

I haven't had a reason/chance to use one myself yet, but it sounds like it should work.