Search code examples
iosjsonrestsvgsvgkit

iOS : display svg from JSON


I'm trying to display a svg file in my iOS application.

The svg file is given to me by a REST API. So I end up with an answer like this from the API :

{
   "response": {
      "data": {
         “var2”: “svgCodeXML”
      }, "status": "ok"
   } 
}

Currently I'm displaying it in a web view and it's displaying.

I'd like to display the svg directly in my iOS app, without a web view.

I've been looking at the SVGKit library but I haven't found a way to do it.

Do anybody know how to achieve this purpose?

Thank you very much.


Solution

  • You can try using SVG kit. You can find the code and examples here: https://github.com/SVGKit/SVGKit