HTML tags in UILabel don't work

Hi, I've got this html text:

"<style>* {font-size: 12pt !important;color: #000000 !important;font-family: Montserrat-Regular !important;}</style>Perform the following steps:<br><u>Option 1:</u><br><p>1) Upon receiving a push notification alert, tap on the push notification to launch BIMB Authenticator</p><p>2) Verify the transaction details and choose \"Approve\"</p><p>3) Complete</p><br><u>Option 2:</u><br><ol><p>1) If you didn’t receive push notification, you may launch BIMB Authenticator</p><p>2) Verify the transaction details and choose \"Approve\"</p><p>3) Complete</p>"

And I'm trying to show this HTML text properly in a UILabel. This is my codes:

String extension to map to NSAttributedString:

extension String {
    func attributedStringFromHTML() -> NSAttributedString? {
        guard let data = "\(self)"
            .data(using: .utf8, allowLossyConversion: false) else {
            Log.error(category: .transaction, message: "Unable to decode data from html string: %@", self)
            return nil
        }
        
        let options: [NSAttributedString.DocumentReadingOptionKey: Any] = [
            .documentType: NSAttributedString.DocumentType.html,
            .characterEncoding: String.Encoding.utf8.rawValue
        ]
        
        if let attributedString = try? NSAttributedString(data: data, options: options, documentAttributes: nil) {
            return attributedString
        } else {
            Log.error(category: .transaction,
                      message: "Unable to create attributed string from html string: %@",
                      self)
            return nil
        }
    }
}

And this is the result:

Can you tell me how to fix this? Thanks.

HTML tags in UILabel don't work
 
 
Q