首页 > 这段代码是什么结构

这段代码是什么结构

下面代码的responseString 是一个Function, 这个Function后面直接跟Closure。有大神来解释一下么

Alamofire.request(request).responseString { (resp) -> Void in
            print(resp)
        }

不就是等同于把closure当成一个函数类型的参数传给responseString嘛。这种在表面上模拟“函数式编程”的写法,最大的好处就是可以让你不需要吧resp变量声明在外面。


好吧,来自答了,尾随闭包,怪我之前没有好好看语法

【热门文章】
【热门文章】