Change to not force unwrap the descriptor. Issue #1818
This commit is contained in:
parent
23b8af4634
commit
d222a9f617
|
@ -11,8 +11,11 @@ import UIKit
|
|||
extension UIFont {
|
||||
|
||||
func withTraits(traits:UIFontDescriptor.SymbolicTraits) -> UIFont {
|
||||
let descriptor = fontDescriptor.withSymbolicTraits(traits)
|
||||
return UIFont(descriptor: descriptor!, size: 0) //size 0 means keep the size as it is
|
||||
if let descriptor = fontDescriptor.withSymbolicTraits(traits) {
|
||||
return UIFont(descriptor: descriptor, size: 0) //size 0 means keep the size as it is
|
||||
} else {
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
func bold() -> UIFont {
|
||||
|
|
Loading…
Reference in New Issue