xcode - Swift - Xcode 7.3 中的闭包不能有关键字参数错误

标签 xcode swift api

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

然后它要求我删除参数类型名称。

enter image description here

这可能是什么问题?

最佳答案

自 Swift 2.2(Xcode 7.3 附带)起,声明如下:

button.selectionHandler = { (CNPPopupButton button) -> Void in

应该是

button.selectionHandler = { (button : CNPPopupButton) -> Void in

这确实让人感觉更像 Swift。如果不想确定类型,也可以使用简写语法:

button.selectionHandler = { button in

关于xcode - Swift - Xcode 7.3 中的闭包不能有关键字参数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36307766/

相关文章:

ios - Xcode Swift - 如何从拆分 Controller 转到特定的导航 View Controller

iphone - 根据手势重新排列 UIIview

swift - 创建新的 NSManagedObject 并将其分配给新的 NSManagedObject *有时*会失败

ios - 可扩展的 UICollectionViewCell

swift - 抓取加载的网页 URL? WKWebView macOS

javascript - 谷歌地图 Geojson 信息窗口

Python 使用用户名、密码和 API key 连接到 API

cocoa - Xcode 断点 [NSExceptionRaise] 与 -[NSExceptionRaise]

api - 获取 System.InvalidOperationException : The constraint reference ' int' could not be resolved to a type

iphone - XCode 4 - 轻松访问安装到模拟器上的应用程序的 "Documents"文件夹