Ios 我需要帮助将swift 3写入swift 4
你是怎么用swift 4写的?我收到错误信息: 使用未解析标识符“NSFontAttributeName” 这是密码Ios 我需要帮助将swift 3写入swift 4,ios,swift,xcode,swift3,swift4,Ios,Swift,Xcode,Swift3,Swift4,你是怎么用swift 4写的?我收到错误信息: 使用未解析标识符“NSFontAttributeName” 这是密码 let size: CGSize = text.size(attributes: [NSFontAttributeName: UIFont.systemFont(ofSize: 14.0)]) Swift 4.2 let size = text.size(attributes: [NSAttributedString.Key.font: UIFont.systemFont(of
let size: CGSize = text.size(attributes: [NSFontAttributeName: UIFont.systemFont(ofSize: 14.0)])
Swift 4.2
let size = text.size(attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 14.0)])
斯威夫特4
let size = text.size(attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 14.0)])
你没有从编译器那里得到修复建议吗?单击“读取错误”符号,它似乎已进行了轻微调整。Swift希望删除字符串和键之间的句点,而属性必须更改为withAttributes。谢谢你的帮助!这取决于swift版本。请参见编辑。您不能只使用[.font:.systemFrontofSize:14]吗?