Book Image

Reactive Programming with Swift 4

By : Navdeep Singh
Book Image

Reactive Programming with Swift 4

By: Navdeep Singh

Overview of this book

RxSwift belongs to a large family of Rx implementations in different programming languages that share almost identical syntax and semantics. Reactive approach will help you to write clean, cohesive, resilient, scalable, and maintainable code with highly configurable behavior. This book will introduce you to the world of reactive programming, primarily focusing on mobile platforms. It will tell how you can benefit from using RxSwift in your projects, existing or new. Further on, the book will demonstrate the unbelievable ease of configuring asynchronous behavior and other aspects of the app that are traditionally considered to be hard to implement and maintain. It will explain what Rx is made of, and how to switch to reactive way of thinking to get the most out of it. Also, test production code using RxTest and the red/ green approach. Finally, the book will dive into real-world recipes and show you how to build a real-world app by applying the reactive paradigm. By the end of the book, you’ll be able to build a reactive swift application by leveraging all the concepts this book takes you through.
Table of Contents (15 chapters)
Free Chapter
1
Migrating from Swift 3 to Swift 4
2
FRP Fundamentals, Terminology, and Basic Building Blocks
3
Set up RxSwift and Convert a Basic Login App to its RxSwift Counterpart
8
RxTest and Custom Rx Extensions – Testing with Rx
10
Schedule Your Tasks, Don't Queue!
11
Subscribe to Errors and Save Your App
12
Functional and Reactive App-Architecture

Summary

The bottom line is that for Networking in RxSwift, you have several choices. Our suggestion is that you learn how to use the core RxCocoa networking extensions first and then check out Moya; or, if you are already a heavy Alamofire user, RxAlamofire is the way to go.

In this chapter, we created a real-world simulation of a small-scale application that is usable to a certain extent. We learned how to bundle most of the concepts that we covered throughout the book in this application. This chapter provided you with the gist of how to invoke APIs, how to parse data that was returned from the API, and then, using a ViewModel, how to plug the data into the View. The design pattern that we used was MVVM, which is the most favorable design pattern when it comes to writing RxSwift code.

In this book, we have introduced you to reactive programming with reactive extensions for Swift...