I have a NSMutableAttributedString and want to convert it back into a simple String.
var attributedString = NSMutableAttributedString(string: "hello w0rld")
How can I get just the String out of a NSMutableAttributedString the easiest?
I have a NSMutableAttributedString and want to convert it back into a simple String.
var attributedString = NSMutableAttributedString(string: "hello w0rld")
How can I get just the String out of a NSMutableAttributedString the easiest?
Use the string property on NSMutableAttributedString:
var attributedString = NSMutableAttributedString(string: "hello, world!")
var s = attributedString.string
If you strictly want an NSString, not a String use the following:
let s = attributedString.string as NSString
if you want to keep the atributted string simply use yourLabel.attributedText = atributedTtext