Find answers here
Menu
I want to declare a closure that takes one or more parameters and/or returns some result.
// Declare a closure with 2 integer arguments
// returning an Integer
let multiply = {(x:Int,y:Int)->Int in
return x*y
}
// Call it
let result = multiply(2,5)
print(result)
Objective-C to Swift language converter | Visit iSwift Stories
WE CODE.