i\'m using font.fontDescriptor.symbolicTraits.contains(.traitBold) but this function is returns true if font is semibold, extra bold or an
font.fontDescriptor.symbolicTraits.contains(.traitBold)
semibold
extra bold
You can use something like:
let attributes = font.fontDescriptor.fontAttributes let traits = attributes[.traits] as? [UIFontDescriptor.TraitKey : Any] let weight = traits[.weight] as? UIFont.Weight
Then, you can compare the weight to .bold.
.bold