2

This code worked in Swift 3, but Xcode is complaining in Swift 4. I keep getting this error:

Cannot convert value of type '[NSAttributedString.DocumentAttributeKey : NSAttributedString.DocumentType]' to expected argument type '[NSAttributedString.DocumentReadingOptionKey : Any]'

I'm sure it's simple but every change I've tried isn't working.

func eulaAlert() {
    print("\(globalVars.eulaAgree)")
    let url = Bundle.main.url(forResource: "AltitudeAlertUA", withExtension: "rtf")!
    let opts = [NSAttributedString.DocumentAttributeKey.documentType:NSAttributedString.DocumentType.rtf]
    var d : NSDictionary? = nil
    let s = try! NSAttributedString(url: url, options: opts, documentAttributes: &d)
    self.tv.attributedText = s
}

0 Answers0