我是Swift的新手。我用Swift 4创建了一个应用程序,但当我将SWIFT_VERSION更改为Swift 3.0时,我的代码出现错误。
类型'String'没有成员'foregroundColor'。
如何将其转换为当前的Swift语法?
代码:
if let p = placeholder {
let place = NSAttributedString(string: p, attributes: //error -->[.foregroundColor: #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)])
attributedPlaceholder = place
textColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)