I checked the documentation and the method is there.
And when I look in the .h file I do see the function. I've tried cleaning and rebuilding and I still get this error after migrating to Swift 4.
Value of type 'NSAttributedString' has no member 'addAttributes'
On the following:
var options:[NSAttributedString.DocumentReadingOptionKey : Any] = [NSAttributedString.DocumentReadingOptionKey.documentType : NSAttributedString.DocumentType.html]
var attributedString = try NSAttributedString(data: data, options: options, documentAttributes: nil)
let range = (attributedString.string as NSString).range(of: attributedString.string)
attributedString.addAttributes(baseAttributes, range: range) // ERROR!
For anyone else brought here by Google, I was missing import UIKit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With