After upgrade the Xcode to 12.5. I notice declare a variable with the same name method is no longer occurs compiler error.
Reference: Why doesn't Swift allow a variable and a function with the same name?
Is that a feature from some proposal? I'm not find anything about that from the release notes.
class ViewController: UIViewController {
func hello() -> String {
return "Hi"
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let hello = hello()
print(hello)
}
}
Thanks.