This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension String { | |
| func convertAttributedString() -> NSAttributedString?{ | |
| let html = self._removePT() | |
| let encoded = html.data(using: String.Encoding.utf8)! | |
| let attributedOptions : [NSAttributedString.DocumentReadingOptionKey : Any] = [ | |
| .documentType : NSAttributedString.DocumentType.html, | |
| .characterEncoding : String.Encoding.utf8.rawValue | |
| ] | |
| do { | |
| let attributedTxt = try NSAttributedString(data: encoded, options: attributedOptions, documentAttributes: nil) |