我想声明一个闭包类型的局部变量,我该怎么做?
最佳答案
var myClosure: (myParamaterTypes) -> myReturnTypes
例如:
var myClosure: (Int, Int) -> Int // type is (Int, Int) -> Int
myClosure = {(integer01: Int, integer02: Int) -> Int in return integer01 + integer02}
关于swift - 如何在 swift 中声明一个闭包的局部变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31657464/