我尝试了以下代码并得到警告:
=== AttributeGraph: cycle detected through attribute 682680 ===
扩大
extension Data {
var html2AttributedString: NSAttributedString? {
do {
return try NSAttributedString(data: self, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)
} catch {
print("error:", error)
return nil
}
}
var html2String: String { html2AttributedString?.string ?? "" }
}
extension StringProtocol {
var html2AttributedString: NSAttributedString? {
Data(utf8).html2AttributedString
}
var html2String: String {
self.html2AttributedString?.string ?? ""
}
}
swiftui:
description = "<p class=\"uitk-flex-item uitk-flex-basis-full_wi......."
Text(description.html2String)
我不明白为什么会发出警告,因为在发出警告后,我的代码行为非常奇怪。有人有Idae吗?