Last active
March 7, 2016 21:12
-
-
Save aguilarpgc/60f262eb77568e0d5042 to your computer and use it in GitHub Desktop.
font extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| public extension UIFont { | |
| enum Type: String { | |
| case Light = "Roboto-Light", | |
| Regular = "Roboto-Regular", | |
| Medium = "Roboto-Medium", | |
| Thin = "Roboto-Thin", | |
| Bold = "Roboto-Bold" | |
| } | |
| // MARK: - Methods - | |
| // MARK: - Class Methods - | |
| /** | |
| This uses 'Roboto' family font with 5 types : | |
| - Thin | |
| - Light | |
| - Regular | |
| - Medium | |
| - Bold | |
| - parameter type: The type of font: UIFont.Type | |
| - parameter size: The size | |
| */ | |
| class func fontRoboto(type: Type, size: CGFloat) -> UIFont { | |
| let font = UIFont(name: type.rawValue, size: size) | |
| return font! | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment