Skip to content

5-Minute iOS Tips Video Series

Check out the playlist for the “5-Minute iOS Tips” I did for Accelebrate – there will be 4 in the series as of now. The related code files are here.

 

In this video I show you how to use shorthand argument names in your Swift Higher Order Functions.

 

Shorthand argument names help you make your code more concise, readable and prevents it from being changed such that it affects the functionality or performance.

Shorthand Argument Names

I used shorthand argument names all the time. If you understand the function being used, they allow for better readability. No need to remember what the parameter names are that are used in the closure.

They also help make your code very concise. Quite easily several lines of code can become one. But it doesn’t have to be complex.

When using single-expression closures, the return is automatic. This also makes code concise and readable, but also prevents someone from changing the functionality without clearly taking over the code. Easy blame game fodder.

I hope you enjoy this series!