弃用具有多个参数的重命名方法
Deprecating renamed method with multiple arguments
我想为 Swift 3 更新以下方法的命名:
public func imageWithUrl(url: String, placeholderNamed: String) {
if let image = UIImage(named: placeholderNamed) {
imageWithUrl(url: url, placeholder: image)
} else {
imageWithUrl(url: url)
}
}
到
public func image(url: String, placeholderNamed: String) {
所以我弃用了旧方法:
@available(*, deprecated: 1.8, renamed: "image(url:, placeholder:")
问题是我收到以下错误:
'renamed' argument of 'available' attribute must be an operator, identifier, or full function name, optionally prexied by a type name
我在 renamed:
部分遇到了问题。为了解决这个问题,只需将其更改为
@available(*, deprecated: 1.8, renamed: "image(url:placeholder:)")
我想为 Swift 3 更新以下方法的命名:
public func imageWithUrl(url: String, placeholderNamed: String) {
if let image = UIImage(named: placeholderNamed) {
imageWithUrl(url: url, placeholder: image)
} else {
imageWithUrl(url: url)
}
}
到
public func image(url: String, placeholderNamed: String) {
所以我弃用了旧方法:
@available(*, deprecated: 1.8, renamed: "image(url:, placeholder:")
问题是我收到以下错误:
'renamed' argument of 'available' attribute must be an operator, identifier, or full function name, optionally prexied by a type name
我在 renamed:
部分遇到了问题。为了解决这个问题,只需将其更改为
@available(*, deprecated: 1.8, renamed: "image(url:placeholder:)")