无法调用非函数类型'[String:String]'

时间:2018-07-25 03:59:00

标签: swift

我是iOS和Swift的新手,所以我不明白实际的问题是什么。我正在尝试使用套接字检查谁在聊天应用程序中键入内容。

1 个答案:

答案 0 :(得分:0)

Swift 4.0

Closure is we can say that function as argument, So function have parameter and return type also.

As per your code you missed to specify the return type of function, If closure return nothing than you must have to defined Void return type.

func getTypingUser(_ completionHandler: ([String: String]) -> ()) {
    guard let typingUser = dataArray[0] as? [String : String] else { return }
    completionHandler(typingUser)
}