Skip to content

Instantly share code, notes, and snippets.

@wagnercasey
Last active March 3, 2017 19:06
Show Gist options
  • Select an option

  • Save wagnercasey/9ce399878c6ce446b8774f39990c25a5 to your computer and use it in GitHub Desktop.

Select an option

Save wagnercasey/9ce399878c6ce446b8774f39990c25a5 to your computer and use it in GitHub Desktop.
UIFontWeight Struct for autocomplete
struct FontWeight {
static let ultraLight: CGFloat = UIFontWeightUltraLight
static let thin: CGFloat = UIFontWeightThin
static let light: CGFloat = UIFontWeightLight
static let regular: CGFloat = UIFontWeightRegular
static let medium: CGFloat = UIFontWeightMedium
static let semiBold: CGFloat = UIFontWeightSemibold
static let bold: CGFloat = UIFontWeightBold
static let heavy: CGFloat = UIFontWeightHeavy
static let black: CGFloat = UIFontWeightBlack
}
extension UIFont {
class func weightedSystemFont(ofSize size: CGFloat, weight: FontWeight) -> UIFont {
return UIFont.systemFont(ofSize: size, weight: weight.weight)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment