Gridicons 1.0.1

Gridicons 1.0.1

TestsTested
LangLanguage SwiftSwift
License GPL-2.0
ReleasedLast Release Apr 2020
SPMSupports SPM

Maintained by James Frost, Diego Rey Mendez, Diego Rey Mendez, Enej Bajgoric, Antonis Lilis, Ernesto Carrion, Jorge Leandro Perez, Paolo Musolino, Eduardo Toledo, Gerardo Pacheco, Brandon Titus, Daniele Bogo, Jorge Bernal, Aaron Douglas, Sérgio Estêvão, Elisa Budelli, Cesar Tardaguila, Thuy Copeland, Lorenzo Mattei, Matt Bumgardner, Eric Johnson, Eduardo Toledo, Stephenie Harris, Jaclyn Chen, Chip Snyder, Jeremy Massel, Pinar Olguc, Emily Laguna, Leandro Alonso, Paul Von Schrottky, Stefanos Togoulidis, Ceyhun Ozugur, Giovanni Lodi, Jayson Basañes, Rachel McRoberts, Yael Rubinstein, Giorgio Ruscigno, Automattic Mobile.



Gridicons 1.0.1

CircleCI Version License Platform

Gridicons iOS

Gridicons-iOS is a small framework which produces images of the Gridicons icon set.

The framework can be installed either via CocoaPods:

pod 'Gridicons', :podspec => 'https://raw.github.com/Automattic/Gridicons-iOS/develop/Gridicons.podspec'

or Carthage:

github 'Automattic/Gridicons-iOS'

Usage

First, import the framework:

import Gridicons

Getting a UIImage of a Gridicon is as simple as:

let icon = UIImage.gridicon(.pages)

With type inference, this can be shortened further:

icon = .gridicon(.pages)

You can optionally specify a size (default is 24 x 24):

let icon = UIImage.gridicon(.pages, size: CGSize(width: 100, height: 100))

The images that the framework produces use the AlwaysTemplate rendering mode, so you can tint them however you like.

Adding new icons

To add new icons as they're added to the Gridicons icon set, complete the following steps:

  • Add the icon from the pdf directory in the main Gridicons project to the Gridicons.xcassets catalog in this project
  • Rename the icon so it no longer has the gridicons- prefix
  • Select the icon in the asset catalog and change these settings:
    • Render As -> Template Image
    • Resizing -> Preserve Vector Data
    • Scales -> Single Scale
  • If you haven't already, run rake dependencies to install SwiftGen
  • Run rake gen to regenerate the GridiconsGenerated.swift file
  • Commit your changes and release a new pod version.

Updating existing icons

If you need to update a existing icon, update the PDF in the asset catalog with the new version and release a new pod version.

License

Gridicons-iOS is licensed under GNU General Public License v2 (or later).