79122003

Date: 2024-10-24 13:04:58
Score: 0.5
Natty:
Report link

You can also use AttributedString functionality. So on this way underline will also always be valid for localized texts with underlinedText which takes e.g. two lines. The solution from Ina on the top doesn't work for me, but inspired me to try this way out and it works!

private var attributedString: AttributedString {
    var attributedString = AttributedString("underlined text")
    attributedString.underlineStyle = .single
    attributedString.baselineOffset = 5
    
    return attributedString
}

var body: some View {
  Text(attributedString)
}
Reasons:
  • Whitelisted phrase (-1): try this
  • RegEx Blacklisted phrase (2): doesn't work for me
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Illya Krit