From the Swift 2.x documentation:
Local and External Parameter Names for Methods
Function parameters can have both a local name (for use within the
function’s body) and an external name (for use when calling the
function), as described in Specifying External Parameter Names. The
same is true for method parameters, because methods are just functions
that are associated with a type.…
Swift gives the first parameter name in a method a local parameter
name by default, and gives the second and subsequent parameter names
both local and external parameter names by default. This convention
matches the typical naming and calling convention you will be familiar
with from writing Objective-C methods, and makes for expressive method
calls without the need to qualify your parameter names.
To match exactly the Swift 1.0 syntax in your screenshot you have to write
func isDivisible(divided divided: Int, divisor: Int) -> Bool {}
By the way: if divided % divisor
does not compile, you can replace the whole function body by
return divided % divisor == 0
1
solved Why am i getting this error (swift 2.2, dealing with func and named parameters)? [closed]