Swift-WKWebView加载带转义的htmlString

extension String {
    var htmlToString:String {
        return try! NSAttributedString(data: Data(utf8),
                                       options: [.documentType: NSAttributedString.DocumentType.html,
                                                 .characterEncoding: String.Encoding.utf8.rawValue],
                                       documentAttributes: nil).string
    }
}

你可能感兴趣的:(Swift-WKWebView加载带转义的htmlString)