Updated for Swift 5
Learn core concepts of functional programming with Swift and leverage them in real world code.
by Chris Eidhof, Florian Kugler, and Wouter Swierstra
Swift opens up a whole new world of programming that we’re going to explore in this book. To quote Swift’s creator, Chris Lattner:
“Objective-C without the C” implies something subtractive, but Swift dramatically expands the design space through the introduction of generics and functional programming concepts.
We’ll explain the concepts behind functional programming and how Swift makes it easy to leverage them in a pragmatic way, in order to write clearer and more expressive code.
Get to know the functional programming paradigm
Higher-order functions and functional manipulation of collections
Designing functional, composable, and type-safe APIs
How Swift solves the “missing value” problem, and why that's a good idea
Benefits of value types and immutability
Create your own data types with Swift's enums for clarity and type safety
Use recursive enums to write simple data structures
Understand the machinery underlying Swift's collection types
A functional parsing library and a simple spreadsheet app as example
Common patterns underlying functional code