I want to increase font size of html attributed string
. I also followed this question but still it not working. I am using below code for changing html string
to attributed string
.
let strmy = model.strItineraryDescription.html2AttributedString
lblDescription.attributedText = strmy
extension String {
var html2AttributedString: NSAttributedString? {
do {
return try NSAttributedString(data: Data(utf8), options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: String.Encoding.utf8.rawValue,NSFontAttributeName : UIFont.systemFont(ofSize: 20.0, weight: UIFontWeightSemibold)], documentAttributes:nil)
} catch {
print(error)
return nil
}
}
var html2String: String {
return html2AttributedString?.string ?? ""
}
}
My html
string like below :-
<strong><u>Featured Program</u></strong></p>
\n<ol>
\n <li>Arrival at Delhi airport. You will receive by our representative.</li>
\n <li>Driving to Agra and exploring the city.</li>
\n <li>Back to Hotel for Overnight stay.</li>
\n</ol>
\n<p><strong>City Features</strong></p>
\n<ol>
\n <li><strong>Visit to Agra Fort \U2013 </strong>Former Name Badalgarh, Shah-Jahan spent his last eight years here. You can watch the mesmerizing view of Taj Mahal from this fort just like Shah Jahan.</li>
\n <li><strong>Visit to Taj Mahal \U2013</strong> It took 21 years to build and stood in 1653. The palace is considered as the symbol of love. Shah Jahan built this wonder in the memory of his wife Mumtaj Mahal.</li>
\n</ol>
\n<p><strong>(Both Agra Fort and Taj Mahal are UNESCO Declared world heritage site)</strong>