Given a UIFont or a CTFont, how can I tell whether the font is bold/italic?
Given a UIFont or a CTFont, how can I tell whether the font is bold/italic?
Answer for Swift 3/4 based on Arjan's answer:
extension UIFont {
var isBold: Bool {
return fontDescriptor.symbolicTraits.contains(.traitBold)
}
var isItalic: Bool {
return fontDescriptor.symbolicTraits.contains(.traitItalic)
}
}