Having some issues getting strikethrough to work. Currently I'm doing the following:
theString.addAttributes([
NSAttributedStringKey.strikethroughStyle: NSUnderlineStyle.styleSingle.rawValue,
NSAttributedStringKey.strikethroughColor: UIColor.white
], range: NSMakeRange(0, 1))
It's not showing any sort of strikethrough though. Any ideas? I can't seem to find anything that works.
Swift 5.1
let attributedText : NSMutableAttributedString = NSMutableAttributedString(string: "Your Text")
attributedText.addAttributes([
NSAttributedString.Key.strikethroughStyle: NSUnderlineStyle.single.rawValue,
NSAttributedString.Key.strikethroughColor: UIColor.lightGray,
NSAttributedString.Key.font : UIFont.systemFont(ofSize: 12.0)
], range: NSMakeRange(0, attributedText.length))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With