swift - 未知的 Swift 语法

标签 swift

我正在浏览 this来自 Mikeash 的博客并找到以下声明:

private let f: AnyObject -> Parameters -> Void

我不清楚这个语法是什么意思。我尝试查看 Swift 编程指南,但没有找到任何答案。

有人可以解释一下吗,可能是一些引用?

最佳答案

参见 Swift Programming Language Reference ,章节类型,标题函数类型:

The function types of a curried function are grouped from right to left. For instance, the function type Int -> Int -> Int is understood as Int -> (Int -> Int) — that is, a function that takes an Int and returns another function that takes and return an Int. Curried function are described in Curried Functions.

(我格式化了代码部分)

参见 here有关柯里化(Currying)函数的解释。

关于swift - 未知的 Swift 语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28493113/

相关文章:

php - iOS Swift 5 - 通过调用 PHP 函数使用服务器上传文件

php - Swift 4 - 解析 JSON 时错误代码 = 3840 "Garbage at end."

ios - Xcode 摄像头 : Failed to read exposureBiasesByMode dictionary

ios - swift 中的自定义 Collection View 单元格

ios - 当协议(protocol)的可空性发生变化时支持多个 iOS SDK 版本

ios - UICollectionView 顶部单元格在动画键盘外观时消失

ios - 从一个类发送信号到 View Controller 或在填充 UITextField 时触发函数

ios - 添加和删​​除事务队列观察器 - 正确的方法?

xcode - 使用 Swift 解析 : this class is not key value coding-compliant for the key submit. '

ios - 如何在 JSQMessagesViewController 中使消息气泡居中