I'm trying to add a bold trait on an NSMutableAttributedString that may already be italics or underlined.
here is my current implementation which changes the whole font, thus losing the already existing traits.
let text = NSMutableAttributedString(attributedString: textView.attributedText)
let normalFont = AppearanceManager.shared.font
let boldFont = UIFont(descriptor: (normalFont?.fontDescriptor.withSymbolicTraits(.traitBold))!, size: normalFont?.pointSize ?? 14)
//instead of adding .font, how do I just add a bold trait to the current font?
text.addAttribute(.font, value: boldFont, range: textView.selectedRange)
textView.attributedText = text