This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| extension NSAttributedString { | |
| static func fromHTML(_ html: String, execute: @escaping (NSAttributedString?) -> Void) { | |
| DispatchQueue.main.async { | |
| let options = [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.html] | |
| // only run on main queue | |
| let result = try? NSAttributedString(data: Data(html.utf8), options: options, documentAttributes: nil) | |