I ma migrating over to Swift 2 and trying to resolve all the compile errors and have found the code the link below which is apparently the new way to process html text, but I cannot see how to use this in my functions in swift 2?
in swift 1.2 I used:
attributedText.appendAttributedString(htmlString.html2AttributedString)
and
extension String {
var html2AttributedString:NSAttributedString {
return NSAttributedString(data: dataUsingEncoding(NSUTF8StringEncoding)!,
options: [NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: NSUTF8StringEncoding],
documentAttributes: nil,
error: nil)!
}
}
This is the new way of doing it apparently String extension