3. Making Things Happen: Functions

This chapter discusses functions. You will find that Swift functions are based on a similar implementations of functions in other languages like. Swift functions provide you with lots of flexibility to create parameters that are both “internal” and “external,” which jibes well with Objective-C. Internal and external parameters allow you to have functions that are easy to read. You’ll be able to quickly read the name of a function and know exactly what it does. This is one excellent feature of Objective-C that has made its way into Swift.

A function itself can also be passed as a parameter of another function, also known as anonymous functions. This makes it easy to pass parameters around to different contexts. ...

Get Learning Swift 2 Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.