user6510422 user6510422 - 6 months ago 42
Swift Question

Swift 3 first parameter names

In Swift 2, it appears that the first parameter name is not always required when calling a function. Now in Swift 3, the first parameter name is required when calling the function. For example:

func frobnicate(runcible: String) {
print("Frobnicate: \(runcible)")

Swift 2.2 allowed the function to be called by simply typing:


Swift 3 seems to be requiring that we use the first parameter names of methods such as:


Is this the case with Swift 3 for all functions and methods or just certain situations?


Yes, this is right. Swift is fixing a language inconsistency this way (this was always required for initializers).

If you don't want to use the external parameter name, just remove it explicitly:

func frobnicate(_ runcible: String) { 
    print("Frobnicate: \(runcible)") 

You can read the full rationale in Swift Evolution 0046