I\'m following an online tutorial to build a magazine type iOS application. I\'m attempting to use NSAttributedStringKey but keep getting the error shown below. Any ideas?>
Swift 4.1 and Xcode 9.3 changes Attributed key value.
let strName = "Hello Stackoverflow"
let string_to_color2 = "Hello"
let attributedString1 = NSMutableAttributedString(string:strName)
let range2 = (strName as NSString).range(of: string_to_color2)
attributedString1.addAttribute(NSAttributedStringKey.foregroundColor, value: UIColor.red , range: range2)
lblTest.attributedText = attributedString1
Hello will be in red color.