Error404 Error404 - 1 year ago 63
Swift Question

Material icons library is not detected on Xcode

I am trying to use

Material Icons
library on my
application on
but I cannot make that the library will be detected by the project.

The steps that I have followed:

  • From here I have copied the link to use git repository.

  • On terminal, I have go through the project folder and use the link that I have copied before.

  • Xcode project does not detect it so I drag it from the folder to the project but I cannot use it.

Am I doing something in the wrong way?

Thanks in advance!

Answer Source

As @EricAya pointed I was following the wrong steps. I saw that there were steps to use Material icons for iOS but as it says in the documentation:

Material icons also work well within iOS apps. In both the material icons library and git repository, these icons are packaged up in Xcode imagesets which will work easily with Xcode Asset Catalogs (xcassets).

I guessed that it could also be installed with git repository but I could not get it. Finally I used the following steps:

  • Go to the official webpage of Material icons and click on the icon that you would like to use.

  • You will see on the right corner of the webpage two options to download the icon (SVG or PNG). I have chosen PNG.

  • Unzip the .zip package.

  • Open ios folder and drag the .imageset folder to your .xcassets file in your project of Xcode.

  • You can create both an imageView or button to set it and use the following code to create the image:


    To set it to your UIImageView you can use yourImage.image and for your button yourButton.setImage().

  • Do not forget to change the tint property of your imageView or button. I spent some hours thinking that it was not working and the problem was that the tint property was white (sometimes simpler things make waste your time easily).