Cannot convert value of type NSAttributedString.DocumentAttributeKey to .DocumentReadingOptionKey

前端 未结 8 1998
鱼传尺愫
鱼传尺愫 2020-12-09 07:18

I found this string extension somewhere on SO that allows me to turn html code into an attributed string:

func html2AttributedString() -> NSAttributedStri         


        
8条回答
  •  忘掉有多难
    2020-12-09 08:24

    Use NSAttributedString.DocumentType.html

    NSMutableAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html] , documentAttributes: nil)
    

提交回复
热议问题