I have the following code to try to underline a label's string.
let attributedString = NSMutableAttributedString(string: "Hello World!")
attributedString.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single, range: NSRange.init(location: 0, length: attributedString.length))
label.attributedText = attributedString
However, when running the code the label shows Hello World!
with no underline.
I'm running Xcode 12.4, and using an iOS 14.4 iPhone 12 Pro Max simulator.
.underlineStyle: NSUnderlineStyle.single.rawValue
– Drover