翻新问题
是否可以用变量参数做闭包?
func this(_ hello: (Int...) -> ()) {}
func that(_ yeah: Int...) {}
下面是可行的。this(that)
下面是不成功的地方this { foo in }
, this { _ in }
, this { }
我得到了这个错误。Cannot convert value of type '(_) -> ()' to expected argument type '(Int...) -> ()'
我甚至把所有 Int...
到 Void...
我也有同样的结果 附加警告:When calling this function in Swift 4 or later, you must pass a '()' tuple; did you mean for the input type to be '()'? Replace '(Void...)' with '()'
然而,将Void...替换为()...就成功了。
let _: (()...) -> () = { _ in }
导致这个错误。Cannot convert value of type '(_) -> ()' to specified type '(()...) -> ()'
有可能解决这个问题吗?