Reputation: 297
For rendering svg file on iPhone I have downloaded a project from GitHub SVGQuartzRenderer but it shows the following errors:
UIKit/UIKit.h No such file or directory
(I am not able to add it using add existing frameworks)Libxml/tree.h:No such file or directory
Expected specifier-qualifier list before xmlParserCtxtPtr
Does anyone know how I can make this project work?
I have also found another framework: SVGKit. It works well for some SVG files but not for all.
Is it possible to render any SVG file in iPhone without using UIWebView
and are there any tutorials or sample code?
Upvotes: 1
Views: 5005
Reputation: 23746
Starting Xcode 12, you can add the .svg file in your Assets Catalog and do this:
let image = UIImage(named: "SomeSVGImage")
ref: https://developer.apple.com/documentation/xcode-release-notes/xcode-12-beta-release-notes
Upvotes: 2