user6510422 user6510422 - 1 year ago 75
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download