Check out example codes for "swift set html text". It will help you in understanding the concepts better.

Code Example 1

extension String {     var htmlToAttributedString: NSAttributedString? {         guard let data = data(using: .utf8) else { return NSAttributedString() }         do {             return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue], documentAttributes: nil)         } catch {             return NSAttributedString()         }     }     var htmlToString: String {         return htmlToAttributedString?.string ?? ""     } }  textView.attributedText = htmlText.htmlToAttributedString

Learn ReactJs, React Native from akashmittal.com