I have migrated to Swift 4
but I have the following error that I can not solve:
Cannont convert value of type '[String: AnyObject]' to expected aegument type '[NSAttributedString.DocumentReadingOptionKey: Any]'
let encodedData = label.text!.data(using: String.Encoding.utf8)!
let attributedOptions: [String: AnyObject] = [
NSAttributedString.DocumentAttributeKey.documentType.rawValue: NSAttributedString.DocumentType.html as AnyObject,
NSAttributedString.DocumentAttributeKey.characterEncoding.rawValue: String.Encoding.utf8.rawValue as AnyObject
]
let attributedString = try NSAttributedString(data: encodedData, options: attributedOptions, documentAttributes: nil)
label.text = attributedString.string
The error appears here:
let attributedString = try NSAttributedString(data: encodedData, options: attributedOptions, documentAttributes: nil)
In the variable: attributedOptions