Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
amorde
· 9y ago · 0 comments
You can also shorten it to:
{ doSomething($0) }
Comments
[–]
slavapestov
9y ago
Or just
doSomething
[–]
reednj
9y ago
I wasn't aware of that syntax? It will just pass the arguments from the parent to the child in order?
[–]
jayrhynas
9y ago
As long as the signature of the function matches you can pass it in directly
[–]
slavapestov
9y ago
Functions are values in Swift. Closure literal syntax is just a shorthand where you don’t have to name the function first.