Skip to content

Instantly share code, notes, and snippets.

@ArchieR7
Created April 11, 2018 16:16
Show Gist options
  • Save ArchieR7/321dafbc406d1c0ddfe75d0f83bd9d4b to your computer and use it in GitHub Desktop.
Save ArchieR7/321dafbc406d1c0ddfe75d0f83bd9d4b to your computer and use it in GitHub Desktop.
convert to swift NSMutableAttributedString
var htmlString = NSMutableAttributedString()
do {
if let data = self.data(using: String.Encoding.unicode, allowLossyConversion: true) {
htmlString = try NSMutableAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html], documentAttributes: nil)
}
} catch {
print(error)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment