Swift - Closure不能有关键字参数错误在Xcode 7.3中

n.b*_*y.n 7 api xcode swift

我已更新到Xcode 7.3,我的一些库包括ToastCNPopupButton给我这个错误: Closure不能有关键字参数

然后它要求我删除参数Type Name.

在此输入图像描述

这可能是什么问题?

Ste*_*mer 6

自Swift 2.2(随Xcode 7.3提供)以来,声明如下:

button.selectionHandler = { (CNPPopupButton button) -> Void in
Run Code Online (Sandbox Code Playgroud)

应该

button.selectionHandler = { (button : CNPPopupButton) -> Void in
Run Code Online (Sandbox Code Playgroud)

确实感觉更像Swift-ish.如果您不想确定类型,也可以使用简写语法:

button.selectionHandler = { button in
Run Code Online (Sandbox Code Playgroud)