swift闭包的另一种用法

这不是教程

当你碰到函数参数需要传递一个闭包(closure)时,一般是可以直接这么传递的(假定无返回):

// 教程一般教你在参数位置传递closure:
someMethod(arg1, arg2, arg3: {
args -> Void in
//codes here
}) // swift同时有一种“同步”的写法:
someMethod(arg1, arg2){
args -> Void in
//codes here
}

  

上一篇:面向对象编程(八)——this关键字


下一篇:Angular.js学习笔记(三)