Hello everyone… I gotta question regarding the Lambda in Kotlin, is it possible to have a variadic function with Lambda?
[Note: I think that ‘variadic’ is not even that word, since parameters maybe of different types...]
Example, I have the following lambda:
- completionBlock: (success: Boolean, responseCode: Int, errorMessageId: Int) -> (Unit)
So that I’d be able to pass it to a function that would accept any lambda (my function does not care for the parameters or return type of the lambda)
func myFunction (anyCompletionBlock: … -> (Unit)) {
//do some computations
//If all was good then execute ==>> anyCompletionBlock
//else do nothing at all
}
Thanks in advance...