These are Swift "functions" not "methods". They do not need parameter names. You can still add them in the declaration for readability, but you cannot use it while calling.
On the other hand, class "methods" are named and work as you expected.
If you still need named parameters while calling, try this:
func greet(name: String, #day: String) -> String {
return "Hello \(name), today is \(day)."
}
greet("Bob", day: "Tuesday")
This will give you expected results.
Find this in documentation:
However, these parameter names are only used within the body of the
function itself, and cannot be used when calling the function. These
kinds of parameter names are known as local parameter names, because
they are only available for use within the function’s body.
A note on methods and functions:
Simply put, methods belong to a class. Functions don't. From documentation:
Functions are self-contained chunks of code that perform a specific
task. You give a function a name that identifies what it does, and
this name is used to “call” the function to perform its task when
needed.
Note that Swift 2.0 makes no difference between method calls and function calls, so in Swift 2.0, your way is valid.