问题
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