What does the arrow (->) between two types mean in Swift?

When studying a single issue, I came across this SO question: How to create general closures in Swift

They have a function definition as follows:

func saveWithCompletionObject(obj : AnyObject, success : AnyObject -> Void, failure : Void -> Void)

What does ->in mean AnyObject -> Void?

+4
source share
3 answers

Property type function . AnyObject -> Voidis a type of function that receives AnyObjectand returns Void.

+5
source
success : AnyObject -> Void

means that the success parameter is a function that receives an object (AnyObject) and returns nothing (Void).

+1
source

→ .

0

Source: https://habr.com/ru/post/1624549/


All Articles