While researching a separate issue, I came across this SO question: How to create generic closures in Swift
They have a function definition like this:
func saveWithCompletionObject(obj : AnyObject, success : AnyObject -> Void, failure : Void -> Void)
What does the ->
in AnyObject -> Void
mean?
It’s a function type. AnyObject -> Void
is the type of a function accepting AnyObject
and returning Void
.
success : AnyObject -> Void
This means that success parameter is a function that receives an object (AnyObject) and returns nothing (Void).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With