Skip to content

PacktPublishing/Swift-Functional-Programming

Repository files navigation

Swift Functional Programming - Second Edition

This is the code repository for Swift Functional Programming - Second Edition, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.

About the Book

Swift is a multi-paradigm programming language enabling you to tackle different problems in various ways. Understanding each paradigm and knowing when and how to utilize and combine them can lead to a better code base. Functional programming (FP) is an important paradigm that empowers us with declarative development and makes applications more suitable for testing, as well as performant and elegant. This book aims to simplify the FP paradigms, making them easily understandable and usable, by showing you how to solve many of your day-to-day development problems using Swift FP.

It starts with the basics of FP, and you will go through all the core concepts of Swift and the building blocks of FP. You will also go through important aspects, such as function composition and currying, custom operator definition, monads, functors, applicative functors, memoization, lenses, algebraic data types, type erasure, functional data structures, functional reactive programming (FRP), and protocol-oriented programming (POP).

You will then learn to combine those techniques to develop a fully functional iOS application from scratch.

Instructions and Navigation

All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.

All chapters contains code files.

The code will look like the following:

let numbers = [9, 29, 19, 79]
// Imperative example
var tripledNumbers: [Int] = []
for number in numbers {
    tripledNumbers.append(number * 3)
}
print(tripledNumbers)

To follow along with the examples in this book, you'll need to have an Apple computer with macOS 10.10 or higher installed. You'll also need to install Xcode 8.3 or newer with Swift 3.1 or newer.

Related Products

Suggestions and Feedback

Click here if you have any feedback or suggestions.

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781787284500