Skip to content

Instantly share code, notes, and snippets.

@aguilarpgc
Last active March 7, 2016 21:12
Show Gist options
  • Select an option

  • Save aguilarpgc/60f262eb77568e0d5042 to your computer and use it in GitHub Desktop.

Select an option

Save aguilarpgc/60f262eb77568e0d5042 to your computer and use it in GitHub Desktop.
font extension
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