Showing HTML text in UILabel -swift

Please use the following steps to show html text in UILabel of swift.

  1. if let attrStr = NSAttributedString(  
  2.     data: "<b><i>this is an html text</i></b>".dataUsingEncoding(NSUnicodeStringEncoding, allowLossyConversion: true) !,  
  3.     options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],  
  4.     documentAttributes: nil,  
  5.     error: nil) {  
  6.     messageLabel.attributedText = attrStr  
  7.   
  8. }  
The output will be like the following:

this is an html text