Converting a NSAttributedString into a NSString using Swift
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