SVG Support

Have you any advice to display SVG in an iOS native app ?


I have tried various third party library like: SwiftSVG, Snowflake, Macaw. But none supports SVG well.


I also tried using WKWebView without great success... (it does not scale my svg correctly)


What do you do when you have to deal with SVG ? It is a bit of a shame Apple does not support it natively.

I'm also struggling with svg on iOS.


Several solutions exist but none of them work perfectly. If you can use png, you will save a lot of time.

If you really don't have any choice you can :


<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8"/>

<meta name='viewport' content='initial-scale=1.0, maximum-scale=3.0, minimum-scale=0.5'/>

<title>SVG Displayer</title>

<style>

html, body, .content {

height: 100%;

width: 100%;

margin:0;

padding:0;

}

</style>

</head>


<body>

<div id="content" align="center">

<img height="300" src= "data:image/svg+xml;base64,SVG_CONTENT"/></img>

</div>

<div id="END"></div>

</body>

</html>


You need to replace SVG_CONTENT with your svg file encoded in base 64.


Note that I have thousands svg coming from external sources and this solution work in most of the files but not all.

SVG Support
 
 
Q