swift set html text
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
Also in HTML:
- bootstrap 4 checkbox
- restart remote computer cmd using ip address
- html2pdf pagebreak option
- html bold text
- reset image tag js
- start html
- html submit button text
- svg circle
- what is b tag in html
- how to change font in html
- vertical bar in html
- how To fetch the index of dropdown in html
- html5 number integer
- iframe align center
- psd to html
- how do you play audio files on html
- html basics
- add a caption of picture html
- How to install CentOS 7 Linux in VMware Workstation
- markdown to html
- Html.ActionLink with parameters
- Finding HTML Elements
- html onclick stop propagation
- xbox roblox games