The various posts showing NSAttributedString rendering html tags has become mute because the bold tag does not work anymore.
Anyone know why? Or what the workaround is?
I am using this as the extension in string (found this in stackoverflow)
var htmlAttributedString: NSAttributedString? {
do {
return try NSAttributedString(data: Data(utf8), options: [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html], documentAttributes: nil)
} catch {
return nil
}
}
var htmlString: String {
return htmlAttributedString?.string ?? ""
}
Bold just doesnt work. I do not see anything wrong with the code itself. It looks right. But it just does not render bold.
I read about adding style tag in the string with the default apple system font in it hardcoded, tried that but didnt work out still.