Я обновляю свое приложение для iOS 13 / Swift 5 и столкнулся с этой ошибкой.Я не уверен на 100%, как это исправить.Любые идеи?
@objc override open var tintColor: UIColor? {
didSet {
#if swift(>=4.2)
var textAttributes = [NSAttributedString.Key : Any]()
let foregroundColorKey = NSAttributedString.Key.foregroundColor
#elseif swift(>=4)
var textAttributes = [NSAttributedStringKey : Any]()
let foregroundColorKey = NSAttributedStringKey.foregroundColor
#else
var textAttributes = [String:Any]()
let foregroundColorKey = NSForegroundColorAttributeName
#endif
textAttributes[foregroundColorKey] = tintColor
#if swift(>=4)
if let attributes = convertFromOptionalNSAttributedStringKeyDictionary(titleTextAttributes(for: .normal)) {
for (key, value) in attributes {
#if swift(>=4.2)
textAttributes[key] = value
#else
textAttributes[NSAttributedStringKey.init(key)] = value
#endif
}
}
#else
if let attributes = titleTextAttributes(for: .normal) {
textAttributes = attributes
}
#endif
setTitleTextAttributes(textAttributes, for: .normal)
}
}
Ошибка его выбрасывания заключается в следующем:
Cannot subscript a value of type '[NSAttributedString.Key : Any]' with an argument of type 'String'