Sunday 17 April 2016

Displaying Vector images on iOS Devices

Good day folks,

Actually, it was  avery good step that Apple added Vector feature to their devices. It has a lot of advantages in my point of view:-

  • Decreasing app size: you don't need 3 types of each image to display it for different resolutions.
  • Decreasing images problems: Some times I got images with some problems in @2x only or @3x only.
But the main problem here is the format Apple supports. It does only support Vector PDF which is not widely common and a lot of images online are a SVG instead.

I wanted to get a way to display SVG on my iOS and I passed by many like PocketSVG and SVGKit. But all of them are very heavy and full of bugs.

So, in the solution here, with some online help, I managed to make this very small-light library. Actually you can say it's a small function which is used to display SVG images not on UIImageView but on UIWebView.

The problem I faced was to resize my SVG on that WebView and I solved it by embedding it into an image.

Check my repository here.

No comments:

Post a Comment