4 ms·
You can also shorten it to: { doSomething($0) }
by amorde 9y ago
You can also shorten it to:
{ doSomething($0) }
- slavapestov 9y agoOr just doSomething
- reednj 9y agoI wasn't aware of that syntax? It will just pass the arguments from the parent to the child in order?
- jayrhynas 9y agoAs long as the signature of the function matches you can pass it in directly
- slavapestov 9y agoFunctions are values in Swift. Closure literal syntax is just a shorthand where you don’t have to name the function first.