2

Not sure about all the ways to use the @rename directive.

I'm trying to rename a method

@available(*, deprecated, renamed: "setValueInTable")
public func setValue(table: String, key: String, value: String, autoDeleteAfter: Date? = nil) -> Bool {

to:

public func setValueInTable(_ table: DBTable, for key: String, to value: String, autoDeleteAfter: Date? = nil) -> Bool

Using the directive gives me the warning, but the auto-fix doesn't handle the parameter names. Is there a way to format the directive so the auto-fix works properly for parameter name changes?

Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70

1 Answers1

1

Swift doesn't support that right now. My suggestion would be to add a message argument to the attribute mentioning the parameter label changes:

@available(*, deprecated, renamed: "setValueInTable", message: "The parameter labels have changed to (_:for:to:autoDeleteAfter:)")
public func setValue(table: String, key: String, value: String, autoDeleteAfter: Date? = nil) -> Bool {}
Caleb Kleveter
  • 11,170
  • 8
  • 62
  • 92