Skip to content

Instantly share code, notes, and snippets.

@raonivaladares
Created April 9, 2018 15:22
Show Gist options
  • Save raonivaladares/19c9516499938cbc81dc94b8d625c86e to your computer and use it in GitHub Desktop.
Save raonivaladares/19c9516499938cbc81dc94b8d625c86e to your computer and use it in GitHub Desktop.
import UIKit
extension UIFont {
enum FontStyle {
case bold
case book
case light
case regular
}
static func defaultAppFonts(style: TextStyle, size: CGFloat) -> UIFont {
var name: String
switch style {
case .bold: name = "Gotham-Bold"
case .book: name = "Gotham-Book"
case .light: name = "Gotham-Light"
case .regular: name = "Gotham-Regular"
}
return UIFont(name: name, size: size) ?? UIFont.systemFont(ofSize: size)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment