Includes free updates to support the latest version of Swift
It may feel as if Functional Programming is a faddish new thing.
Functional Programming goes back more than sixty years and the theory goes back nearly one hundred years.
FP: the oldest new thing
There's nothing natural about Functional Programming. It's awkward, it feels funny, ...
... and then one day you start to see the world differently and you can't remember what was so difficult.
- More tools: A Functional Programming Kickstart is a hands-on, fast-moving kickstart will provide you with a new set of skills that you can add to - not replace - your current favorite programming techniques.
- Simple tools: You already Swift prefers value types over reference types and lets over vars so that your code is easier to reason about. Functional Programming fits nicely into this style of
- Tools to build tools: In no time you’ll be creating and using higher-order functions, embracing value types, avoiding side-effects, and digging deep into map(), flatMap(), and apply().
In A Functional Programming Kickstart you'll learn that what's special about functions is that functions aren't special. That is surprisingly special!
You use functions and methods to get things done but have you ever thought that those things you do with Strings, Ints, and other types can also be done with functions. We begin this book by learning how to construct functions that are safe to use and to pass around.
Sure. You can store functions as properties, create functions that return other functions, and create and use functions that accept other functions. In no time this book will have you creating these so-called higher-order functions and exploring many provided for you in the Swift Standard Library.
Chapter 1 Magic
Chapter 2 Functions aren't special
Chapter 3 Higher-order Functions
Chapter 4 Arrays
Once you’ve explored map() and flatMap() for Arrays you are prepared to take things to a whole other level. We work to see map() and flatMap() as design patterns and not just as functionality we’re given for collections. We’ll see map() as pattern by extending examples provided for Array, Optionals, and the Result type. Once you have the big idea of map() down you’ll understand all the fuss about functors.
This prepares you to look at flatMap() and see how map() allows us to transform a result but flatMap() allows us to interact with our environment. In addition to built in types, and illustrative types we explore the Writer, Reader, and State monads. Understanding this broader context will help you apply the standard bits of the standard library with more confidence and prepare you to master the Combine frameworks.
Chapter 5 Map
Chapter 6 FlatMap
Chapter 7 Apply
Chapter 8 Deeper Magic
What you need
You need a Mac running the latest public release of Xcode.
The code in this book is Swift 5.3 and runs on Xcode 12 or 13 and on macOS 11 Big Sur or macOS 12 Monterey. It has been tested on Apple Silicon.
Check out these free sample PDFs
The Ultimate Bundle
Own all four books and pay 60% of the price of purchasing all four with The Ultimate Bundle.
Who am I?
My name is Daniel Steinberg, and I’ve been teaching Swift since it launched and iPhone development for more than a dozen years. I’ve spoken at countless conferences around the world, taught Swift to multinational companies such as Apple, Google, and eBay, and built apps for Apple’s platforms as far back as System 7.