3

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.

Paul Fitzgerald
  • 11,770
  • 4
  • 42
  • 54
lblyweert
  • 33
  • 3

2 Answers2

1

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

Adibe7
  • 3,469
  • 7
  • 30
  • 36
0

Starting Xcode 12

Asset Catalogs

New Features

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

source: https://developer.apple.com/documentation/xcode-release-notes/xcode-12-beta-release-notes

Ted
  • 22,696
  • 11
  • 95
  • 109
  • 5
    but this is **Asset Catalogs**... How that works if you get the svg image from REST API and try to display it in UIImageView? – beryllium Aug 05 '20 at 12:53