Deprecating renamed method with multiple arguments

谁说胖子不能爱 提交于 2020-01-01 09:17:46

问题


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)
    }
}

to

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:

'renamed' argument of 'available' attribute must be an operator, identifier, or full function name, optionally prexied by a type name


回答1:


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:)")


来源:https://stackoverflow.com/questions/41116200/deprecating-renamed-method-with-multiple-arguments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!