After updating to Swift 4 I am getting an error on this code
attributes["NSFont"] = font
attributes["NSColor"] = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1)
Cannot subscript a value of type '[NSAttributedStringKey : Any]' with an index of type 'String'
I was able to fix the first line by replacing ["NSFont"] with NSAttributedStringKey.font but I am not sure how to fix the second one.
Use
NSAttributedStringKey.foregroundColorfor the second one, keys are not Strings anymore, but enum constants.You can find all the keys in the official docs for NSAttributedStringKey.