diff --git a/MVMCoreUI/Atoms/Views/Label.swift b/MVMCoreUI/Atoms/Views/Label.swift index 4fa300a2..f7a70381 100644 --- a/MVMCoreUI/Atoms/Views/Label.swift +++ b/MVMCoreUI/Atoms/Views/Label.swift @@ -398,11 +398,10 @@ extension Label { } } - func addDefaultAttributes(range: NSRange, string: NSAttributedString?) { + func addDefaultAttributes(range: NSRange, string: NSMutableAttributedString?) { guard let string = string else { return } - let mutableAttributedString = NSMutableAttributedString(attributedString: string) - mutableAttributedString.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range) + string.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range) } fileprivate func setDefaultAttributes(range: NSRange) { @@ -410,8 +409,7 @@ extension Label { guard let attributedText = attributedText else { return } let mutableAttributedString = NSMutableAttributedString(attributedString: attributedText) - mutableAttributedString.addAttributes([NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue], range: range) - + addDefaultAttributes(range: range, string: mutableAttributedString) self.attributedText = mutableAttributedString }