美文网首页
Swift 富文本显示网页内容

Swift 富文本显示网页内容

作者: xiaofu666 | 来源:发表于2024-02-05 15:53 被阅读0次
let html = "网页内容"
if let nsAttributedString = try? NSAttributedString(data: Data(html.utf8), options: [.documentType: NSAttributedString.DocumentType.html], documentAttributes: nil),
   let attributedString = try? AttributedString(nsAttributedString, including: \.uiKit) {
    Text(attributedString)
} else {
    Text(html)
}

相关文章

网友评论

      本文标题:Swift 富文本显示网页内容

      本文链接:https://www.haomeiwen.com/subject/ppmqadtx.html