Last active
March 3, 2017 19:06
-
-
Save wagnercasey/9ce399878c6ce446b8774f39990c25a5 to your computer and use it in GitHub Desktop.
UIFontWeight Struct for autocomplete
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
| 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