swift闭包的另一种用法

这不是教程

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

// 教程一般教你在参数位置传递closure:
someMethod(arg1, arg2, arg3: {
    args -> Void in
    //codes here 
})

// swift同时有一种“同步”的写法:
someMethod(arg1, arg2){
  args -> Void in
  //codes here
}

  

原文地址:https://www.cnblogs.com/walkerwang/p/3819751.html