I just upgraded to Xcode 9 and converted my application from fast 3 to fast 4. I have graphs that use strings to indicate axes and other variables. Therefore, I have moneyAxisString = "Money." I used to be able to draw them using this code:
moneyAxisString.draw(in: CGRect(x: CGFloat(coordinateXOriginLT + axisLength/3), y: CGFloat(coordinateYOriginRT + axisLength + 5 * unitDim), width: CGFloat(300 * unitDim), height: CGFloat(100 * unitDim)), withAttributes: attributes as? [String : AnyObject])
If the attributes are dictionaries defined as follows
attributes = [
NSAttributedStringKey.foregroundColor: fieldColor,
NSAttributedStringKey.font: fieldFont!,
NSAttributedStringKey.paragraphStyle: style
]
Now my application will not compile, and I get a message:
Cannot convert value of type '[String: AnyObject]?' to the expected argument type '[NSAttributedStringKey: Any]?'
source
share