I just upgraded to Xcode 10 and and noticed that I cannot refactor the parameter's name in a function. I haven't been using Xcode 9 for long time. So I am not sure if this was possible in Xcode 9 and Xcode 10 lost it.
Thanks
How to rename a Swift init parameter
I would expect to rename an init parameter where it is declared. Xcode doesn't allow this.
With some experiments, I stumbled upon an unexpected place where init parameters can be renamed: Wherever they are used, you can control click on an init parameter and rename it using the context menu.
class Rename {
// Do NOT control click on parameter here:
init(parameterToBeRenamed: String) {
}
}
class Use {
func test() {
// to rename parameterToBeRenamed, control click on parameter here:
let _ = Rename(parameterToBeRenamed: "Hello World")
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With