diff --git a/SessionUIKit/Components/AttributedText.swift b/SessionUIKit/Components/AttributedText.swift index 5d78608ea..ccac16d3c 100644 --- a/SessionUIKit/Components/AttributedText.swift +++ b/SessionUIKit/Components/AttributedText.swift @@ -5,6 +5,7 @@ struct AttributedTextBlock { let content: String let font: Font? let color: Color? + let underlineColor: Color? } public struct AttributedText: View { @@ -24,9 +25,15 @@ public struct AttributedText: View { let substring = (text.string as NSString).substring(with: range) let font = (attribute[.font] as? UIFont).map { Font($0) } let color = (attribute[.foregroundColor] as? UIColor).map { Color($0) } - descriptions.append(AttributedTextBlock(content: substring, - font: font, - color: color)) + let underlineColor = (attribute[.underlineColor] as? UIColor).map { Color($0) } + descriptions.append( + AttributedTextBlock( + content: substring, + font: font, + color: color, + underlineColor: underlineColor + ) + ) }) } } @@ -36,6 +43,7 @@ public struct AttributedText: View { var text: Text = Text(description.content) if let font: Font = description.font { text = text.font(font) } if let color: Color = description.color { text = text.foregroundColor(color) } + if let underlineColor = description.underlineColor { text = text.underline(color: underlineColor) } return text }.reduce(Text("")) { (result, text) in result + text