什么" - >" 在声明函数时意味着什么?

Bob*_*Bob 10 function-declaration ios swift

示例功能

func example(titles: [String]) `->` [UIButton] {

}
Run Code Online (Sandbox Code Playgroud)

我在哪里可以找到关于这个主题的更多文档(与swift中声明的函数相关的文档)?

Mur*_*nik 23

>swift函数声明中没有- 有人在你正在阅读的页面中搞砸了HTML渲染.它应该是->(一个由hypen和大于运算符组成的箭头),用于表示函数的返回类型.

该文本应该阅读

func example(titles: [String]) -> [UIButton] {

}
Run Code Online (Sandbox Code Playgroud)

这意味着该example函数有一个名为titlestype [String](String数组)的参数,它返回一个[UIButton](UIButton数组).