Refurbished Question
Swift: Combining the use of Variadic Parameters with Closures
Is it possible to make a closure using variadic parameters?
func this(_ hello: (Int...) -> ()) {}
func that(_ yeah: Int...) {}
Here's what works: this(that)
Here's what didn't work:
this { foo in }
, this { _ in }
, this { }
I'm getting this error:
Cannot convert value of type '(_) -> ()' to expected argument type '(Int...) -> ()'
I even went so far as to change all Int...
to Void...
I'm got the same results
With the additional warning of
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 '()'
However, replacing Void... with ()... did the trick
Simplified Problem
let _: (()...) -> () = { _ in }
Causes this error:
Cannot convert value of type '(_) -> ()' to specified type '(()...) -> ()'
Is it possible to work around this?