Using svg icon or font in ios apps

In my iOS application, we need to change the color of the icons based on user configuration. This is one of our important business options.

One of my friends advised me to use the .svg or font icon. And shared me a link

They create web applications during the development of the iOS application. Does iOS support this technique? If so, how can I use it?

Edit

I found SVGKit , which is used for iPhone / iPad applications. Is there any binding library for using it in a single point?

+6
source share
3 answers

SVG fonts (paths) are easily converted to source code. Once you have it, it’s very simple to make them different colors, sizes (iphone / ipad) or resolutions (like retina).

What have i done here . This is for the old version of FontAwesome, but it can be used as (or updated to the latest) for your application.

+5
source

you can use FontAwesome + iOS

all icons available here: link

0
source

If you just need to change the color of the icons, you can probably solve this without svg. Just use the colors of the shades.

Create a template image:

let templateImage = UIImage(named: "bla_bla")?.withRenderingMode(.alwaysTemplate) 

Then add it to the button or image view and set tintColor :

 button.setImage(templateImage, for: .normal) button.setImage(templateImage, for: .highlighted) button.tintColor = UIColor.blue 

This solution only works for monochrome icons!

Also, if you want .svg, you can use WKWebView , it is very fast and will not cause overhead if you have a limited number of icons.

0
source

All Articles