Error in below two lines of code while upgrading from swift 3 to swift 4.2
let lineattribute : [String: Any] = [
NSForegroundColorAttributeName : UIColor(hexString: "#0f88b7ff")!,
NSUnderlineStyleAttributeName : NSUnderlineStyle.styleSingle.rawValue
]
let attributeString = NSMutableAttributedString(string: "View travelling details", attributes: lineattribute)
In Swift 4.2 you have to use NSAttributedString.Key
instead of String
let lineattribute : [NSAttributedString.Key : Any] = [
.foregroundColor : UIColor(hexString: "#0f88b7ff"),
.underlineStyle : NSUnderlineStyle.styleSingle.rawValue
]
let attributeString = NSMutableAttributedString(string: "View traveling details", attributes: lineattribute)
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