Use API that works on both macOS and iOS

This commit is contained in:
Nate Weaver 2020-04-15 16:45:21 -05:00
parent ba73e3289a
commit dc787620c5
1 changed files with 2 additions and 1 deletions

View File

@ -83,7 +83,8 @@ extension NSAttributedString {
convenience init(html: String) {
let data = html.data(using: .utf8)!
self.init(html: data, options: [.characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)!
let options: [NSAttributedString.DocumentReadingOptionKey: Any] = [.characterEncoding: String.Encoding.utf8.rawValue, .documentType: NSAttributedString.DocumentType.html]
try! self.init(data: data, options: options, documentAttributes: nil)
}
}