sha*_*nex 2 arrays function swift
我无法从 Swift 中的函数调用返回数组。
脚本现在有点长,也有点复杂,但这基本上是函数内部的输出:
func getRecentUpdates()
{
var updates = [("test", "hello"),("nice", "one")]
println(updates)
return updates
}
Run Code Online (Sandbox Code Playgroud)
println 在控制台中显示数组,但带有return,错误提示NSArray() is not convertible to ()
这应该有效:
func getRecentUpdates()->[(String,String)]
{
let updates = [("test", "hello"),("nice", "one")]
return updates
}
Run Code Online (Sandbox Code Playgroud)