iosswiftsvgvectorsvgkit

SVGKit performance and should it be preferred over PNG?


I have been looking at SVGKit and I am finding conflicting ideas. Some say it's slower than PNG and others saying it is fast.

I was hoping to get a recommendation and which route I should take. When I am exporting my vector graphics to PNG for display, would it not make sense to use an SVG instead ?

Of course this gives the added value that it remains a vector.

Or is it still recommended in exporting everything to a PNG ?


Solution

  • You might consider the middle-way introduced in Xcode 7. Here you add your assets to the project as vector images (PDF) and at build-time Xcode automatically generates the PNGs in all needed sizes (1x, 2x, 3x).

    Personally, I only use SVGs when necessary, like if I need to be able to change the color of the (parts of the) image. I believe there can be a performance hit when resizing vector images at run-time, although Android uses vectors as default, so it might be insignificant.