Ios 参数标签';(1)及"x27 ;;不匹配任何可用重载-NSAttributedStringKey
我在Swift中获得以下代码Ios 参数标签';(1)及"x27 ;;不匹配任何可用重载-NSAttributedStringKey,ios,swift,Ios,Swift,我在Swift中获得以下代码 dictionary.lazy.map { (NSAttributedStringKey($0.key), $0.value) 代码是: func convertToAttribute(dictionary: [String: Any]?) -> [NSAttributedStringKey: Any]? { guard let dictionary = dictionary else { return nil } let convert
dictionary.lazy.map { (NSAttributedStringKey($0.key), $0.value)
代码是:
func convertToAttribute(dictionary: [String: Any]?) -> [NSAttributedStringKey: Any]? {
guard let dictionary = dictionary else { return nil }
let convertedAttributes = Dictionary(uniqueKeysWithValues:
dictionary.lazy.map { (NSAttributedStringKey($0.key), $0.value) }
)
return convertedAttributes
}
有人能帮我摆脱这个问题吗 您使用的是什么版本的Xcode/Swift?您的代码适用于Xcode 9.4和Swift 4.1.2。是的。。我用的是swift 3…谢谢