弃用具有多个参数的重命名方法 [英] Deprecating renamed method with multiple arguments
本文介绍了弃用具有多个参数的重命名方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为Swift 3更新以下方法的命名方式:
I wanted to update the naming of the following method for 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) {
因此,我弃用了旧方法:
So I deprecated the old method with this:
@available(*, deprecated: 1.8, renamed: "image(url:, placeholder:")
问题是我遇到以下错误:
The problem is that I'm getting the following error:
"available"属性的"renamed"参数必须是运算符,标识符或完整的函数名,可以选择以类型名作为前缀
'renamed' argument of 'available' attribute must be an operator, identifier, or full function name, optionally prexied by a type name
推荐答案
我在renamed:
部分遇到了问题.为了解决这个问题,只需将其更改为
I was having a problem with the renamed:
part. In order to fix that, just change it to
@available(*, deprecated: 1.8, renamed: "image(url:placeholder:)")
这篇关于弃用具有多个参数的重命名方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文