Swift – function-type
Swift function type makes the function to be a first class citizen. You can pass function like objects to any other function like parameters or return values.
Every function has a function type. This function type consists of the parameters and return values. A simple example for function type is shown below.
func add(number1:Int, number2:Int)->Int{
return number1 + number2
}
let myAddFunction = add
println(myAddFunction(1,2))
When you run the above program, we will get the following output.
3