What is $0 and $1 in Swift?

What is $0 and $1 in Swift?
Answer
$0 and $1 are
Closure’s first and second shorthand arguments (a.k.a. Shorthand Argument Names or SAN for short). The shorthand argument names are automatically provided by Swift. The first argument can be referenced by $0 , the second argument can be referenced by $1 , the third one by $2 , and so on.
 

Tìm kiếm

Back
Top