Functional programming

Build a comprehensive understanding of functional programming in Swift, covering not only why it's important and how to use it, but how to go beyond the code and start thinking about the deeper principles at work.

Introductions

These initial articles will focus on the basics of functional programming – why it exists, and what its goals are.

Functional programming in Swift: Introduction

6:52

1. Functional programming in Swift: Introduction

Before you dive in to the first article in this course, I want to give you a brief overview of our goals, how the content is structured, as well as a rough idea of what you can expect to find.

Foundation

In these articles we're going to explore the core code required to use functional programming in your everyday work, helping you get up and running fast.

Building with pure functions

24:27

2. Building with pure functions

If I were to boil functional programming down to just two rules, the first one would be this: prefer to write pure functions as often as you can. What are pure functions, and why would you want them? Let’s start by exploring that in detail…

Functions as first-class types

29:22

3. Functions as first-class types

If I were to boil functional programming down to just two rules, the second rule would be this: functions are first-class types, and should be passed around like any other kind of data. In this article we’re going to explore what that means, and what power it unleashes…

Transforming data with map()

42:32

4. Transforming data with map()

In this article we’re going to look at the map() function, which transforms one thing into another thing. Along the way we’ll also be exploring some core concepts of functional programming, so if you read no other articles in this course at least read this one!

Applying a predicate with contains() and filter()

32:52

5. Applying a predicate with contains() and filter()

In this article we’re going to look at the contains() and filter() functions, which search a sequence to see whether a certain test passes. Along the way you’ll see how similar these two functions are, along with how to build them yourself.

Intermediate

We go beyond pure code and look at how functional programming provides building blocks we can use to create bigger and better things.

Coming soon!

Advanced

This last set of articles moves a step further to explore how the techniques we've learned can be generalized and applied to a wider range of problems.

Coming soon!