Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Swift Functional Programming

You're reading from   Swift Functional Programming Ease the creation, testing, and maintenance of Swift codes

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781787284500
Length 316 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dr. Fatih Nayebi Dr. Fatih Nayebi
Author Profile Icon Dr. Fatih Nayebi
Dr. Fatih Nayebi
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting Started with Functional Programming in Swift FREE CHAPTER 2. Functions and Closures 3. Types and Type Casting 4. Enumerations and Pattern Matching 5. Generics and Associated Type Protocols 6. Map, Filter, and Reduce 7. Dealing with Optionals 8. Functional Data Structures 9. Importance of Immutability 10. Best of Both Worlds and Combining FP Paradigms with OOP 11. Case Study - Developing an iOS Application with FP and OOP Paradigms

Summary


In this chapter, we developed a backend with the Swift Vapor library, which handles the Todo items POST, GET, and DELETE. Then, we developed a frontend iOS application that leverages functional programming, reactive programming, and State management techniques declaratively. We started by developing our Todo model in a functional style, and then we developed a Store object and its extensions to handle State storage, and Action to handle State changes. We defined and used Lens to modify our properties and a WebServiceManager with reflection techniques to request for backend resources.

In this case study, we were able to use value types such as struct and enum and avoid classes. In fact, the only four classes in this case study are related to the iOS SDK (UIViewController, UITableViewController, UITableViewCell, and UIView subclasses). We were able to centralize all State mutations into the Store object, only using Action to change the State in the Store object. Although we did not...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at R$50/month. Cancel anytime