Skip to content

Instantly share code, notes, and snippets.

@malcommac
Created May 21, 2018 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malcommac/e50a424c44df48d4144b53e6f42a98fa to your computer and use it in GitHub Desktop.
Save malcommac/e50a424c44df48d4144b53e6f42a98fa to your computer and use it in GitHub Desktop.
extension UIFont {
func withTraits(traits:UIFontDescriptorSymbolicTraits...) -> UIFont {
let descriptor = self.fontDescriptor()
.fontDescriptorWithSymbolicTraits(UIFontDescriptorSymbolicTraits(traits))
return UIFont(descriptor: descriptor, size: 0)
}
func boldItalic() -> UIFont {
return withTraits(.TraitBold, .TraitItalic)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment