Y
Hacker News
new
|
ask
|
show
|
jobs
by
amorde
3181 days ago
You can also shorten it to:
{ doSomething($0) }
1 comments
slavapestov
3181 days ago
Or just
doSomething
link
reednj
3181 days ago
I wasn't aware of that syntax? It will just pass the arguments from the parent to the child in order?
link
jayrhynas
3181 days ago
As long as the signature of the function matches you can pass it in directly
link
slavapestov
3181 days ago
Functions are values in Swift. Closure literal syntax is just a shorthand where you don’t have to name the function first.
link
doSomething