How to remove attributes from the NSAttributedString swift?
It is very simple. You can use this method from NSMutableAttributedString class
func removeAttribute(_ name: String,
range range: NSRange)
In your case
attr.removeAttribute(NSStrikethroughStyleAttributeName , range:NSMakeRange(0, attr.length))
Use the removeAttribute
method:
attr.removeAttribute(NSStrikethroughStyleAttributeName, range: NSMakeRange(0, attr.length))
In Swift 5
let attributeString: NSMutableAttributedString = NSMutableAttributedString(string: "YourStringHere")
attributeString.removeAttribute(NSAttributedString.Key.strikethroughStyle, range: NSMakeRange(0, attributeString.length))
yourLblHere.attributedText = attributeString