-3
<![CDATA[<p><strong>Basic Guidelines</strong></p>
<p>You are requested to bring all your medical records and reports.</p>
<p>You would be required to come with fasting for 12 hours/overnight for the check up. Please avoid alcohol and any food item with excess fat on the day prior to your check up.</p>
<p>You are requested not to consume tea/coffee/biscuits on the morning of your programme. You may, drink water if you need to.</p>
<p>If you are on any medication, kindly consume them as prescribed. If you are diabetic, please refer to the special note for diabetics. Please stop Beta Blockers (e.g. Atenolol, Metropolol), and Calcium Channel Blockers (e.g. Diltiazem) one day before the preventive health check up (Discuss with your Cardiologist/physician, if required).</p>
<p>Please do not smoke on the day of your programme until you have completed all the investigations.</p>
<p>Please do not wear any jewellery on the day of the programme.</p>
<p>Please bring your spectacles/prescription with you. If you use contact lenses, please do not wear them on the day of programme.</p>
<p>Please do not apply cream, oil, powder on your chest when you come for your programme.</p>
<p>Please get your first morning urine and stool samples in the plastic containers that will be sent to you once you book the appointment.</p>
<p>On arrival, you will be given a uniform for the entire duration of your programme.</p>
<p>Please wear/carry your comfortable sport shoes/sneakers.</p>
<p>Please be prepared to spend 4-5 hours on the day of check up.</p>
<p>There will be a review meeting 3-4 days later with the Medical Consultant/or as advised by the Medical Officer, where all the reports will be handed over to you.</p>
<p><strong>Special note for Diabetics:</strong></p>
<p>Please inform our Guest Relations Executive at the time of registration.</p>
<p>Please do not consume your morning dose of insulin or morning tablets on the day of your programme. Please carry them along with you. And take them at the time of breakfast.</p>
<p>If you are pregnant or suspecting pregnancy or have any doubts, kindly inform the Guest Relations Executive.</p>]]
Larme
  • 24,190
  • 6
  • 51
  • 81
Rupshikha
  • 213
  • 1
  • 3
  • 16
  • Does this answer your question? [Swift: Display HTML data in a label or textView](https://stackoverflow.com/questions/37048759/swift-display-html-data-in-a-label-or-textview) – Larme May 10 '21 at 15:40

1 Answers1

1

Put these methods in your string extension. One is for displaying HTML data in attributed form and other as simple string.

 extension String {
        
        var htmlToAttributedString: NSAttributedString? {
            do {    
                let fontSize: CGFloat = (UIDevice.current.userInterfaceIdiom == .phone) ? 14 : 20
                let modifiedFont = String(format:"<span style= \"font-family: Poppins); font-size: \(fontSize)\">%@</span>", self)
                
                let attrStr = try NSAttributedString(
                    data: modifiedFont.data(using: .unicode, allowLossyConversion: true)!,
                    options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue],
                    documentAttributes: nil)
                return attrStr
            } catch {
                return NSAttributedString()
            }
        }
        
        var htmlToString: String {
            return htmlToAttributedString?.string ?? ""
        }
    }

Use the above methods as follows:

testLabel.attributedText = job_details?.htmlToAttributedString

testLabel.text = job_details?.htmlToString
Shivani Bajaj
  • 996
  • 10
  • 23