Syntax

In this section, we will deep dive into Swift function and method syntax. Boring stuff alert! To make it a little more interesting, revisit or remember the function definition in mathematics and compare the functions and methods you write to math functions.

If you think that you already know the details or if it is not that interesting for you now, you can fast read or skip this first section, and go to the Return values from functions section of this chapter as it is directly related to FP.

Let's get it over with! We define functions or methods as the following:

accessControl methodForm func functionName(parameter: ParameterType) throws -> ReturnType { } 

As we know already, when functions are defined in objects they become methods. ...

Get Swift Functional 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.