This is what I would like to get:
A single function that can, accept any function with any number of parameters of any type and any return type and, execute them inside, in Swift. Is it possible?
For example:
func add(number1: Int, animal: AnimalStruct) {
}
func add1(string: String) {
}
func add2() {
}
func singleAcceptFunction(function) {
//access function's parameters
}
singleAcceptFunction(add)
singleAcceptFunction(add1)
singleAcceptFunction(add2)
Aucun commentaire:
Enregistrer un commentaire