RxSwift: Reactive Programming with Swift - The book review
The last Friday evening and the whole weekend I spent with the first book about RxSwift. It took a couple of months to prepare the book for four authors however, it took me 2 days to read it π . What I’ve found in this book? Who will take the most advantage of reading it? Is it worth reading? This is my personal, subjective and honest opinion about it. Enjoy! π
Who are the authors?
For many of you, the answer is pretty obvious, however for those of you who just starting a journey with RxSwift, I will shortly present the authors.
First of all, the book was written by 4 authors Florent Pillet, Junior Bontognali, Marin Todorov and Scott Gardner who has a practical experience in developing iOS apps with or without RxSwift. As a result, you don’t need to be afraid if the book is written by someone incompetent π. Trust me, it’s not π
- Florent has been developing for iOS since the day 1. He started to write his apps in reactive way before Swift was even announced and has been using RxSwift in production since 2015. Our intelligence says he even use Rx while writing apps on Android π±.
- Junior has also been developing for iOS since the first iPhone and he helped in building RxSwift since the early stage of development. He also writes a blog at sideeffects.xyz
- Marin he is one of the founding members of raywenderlich.com. So far he has worked on ("only" π ) 7 books on raywenderlich brand. You probably know Marin as an author of iOS Animations by Tutorials
- Scott has also been developing for iOS for ages. He has been using RxSwift since before version 1. He is an author of several video courses on lynda.com including stuff about RxSwift ;).
What’s inside? Rx operators step by step
The book has 400 pages and is split into 6 sections. In the first two sections, you will read about what is the Observable, Subject and what are the basic operators. By basic, I mean something about 30 operators π .
What’s great for beginners is that authors describe those operators in packages. At the beginning they define filtering operators then transforming operators, combining operators and time-based operators.
There is more. Each "package" of those operators includes the theory presented inside the playgrounds and right after it, there is a "in practice" chapter which shows the usage of just learned operators. For example, chapter 7 is named "Transforming Operators" while the chapter’s 8 title is "Transforming Operators in Practice".
Moreover, for every "in Practice" chapter there is the source code included, as in others raywenderlich.com books.
Additional stuff – operators aren’t everything!
RxCocoa
The book offers more than just a description of Rx operators. It also explains how to use RxCocoa with reactive properties on UIButton
, UITextField
etc. Everything is explained on the weather-app example.
Testing
The book also describes how to write unit tests using RxTest & RxBlocking libraries. This is a very important chapter to read in my opinion because you writing tests is crucial in any application. It doesn’t matter if use RxSwift or not ;).
However, I need to repeat what the chapter’s author says: "This chapter presumes you are familiar with writing unit tests in iOS using XCTest."
Community Cookbook
The purpose of the book is to teach you how to write your application in reactive way. It cannot be done without great libraries created by the community. There are 5 chapters which explain 5 libraries which simplify writing reactive code:
- RxDataSources
- Action (My fingers always want to write "RxAction" π)
- RxGesture
- RxRealm
- RxAlamofire
MVVM π
Architecting is hard. I think it is one of the hardest subjects at programming. Writing a working application is one thing but writing a scalable application is the other. To make the code easy to change we need to think how we connect our classes.
MVVM works very well while writing reactive applications and I think this is the reason why authors decided to dedicate 2 chapters about it: "MVVM with RxSwift" & "Building a Complete RxSwift App".
In those chapters, you will learn basic ideas about MVVM and what’s the difference between MVC and MVVM or what is a ViewModel. Everything is followed by a nice examples of "Tweetie" and "ToDo" apps.
However, a chapter dedicated to the "ToDo" app is more advanced and provides additional layers like services, scenes and scenes coordinators. You will also have an opportunity to see the practical usage of Action and RxRealm.
Who is this book for?
- For beginners – If you haven’t used Reactive frameworks like RxSwift or ReactiveCocoa before but you want to learn it – the book is definite worth to buy. It’s the only one complete source of knowledge from A-Z about RxSwift. It’s definitely very handy that you don’t need to jump from blog to blog and find materials about RxSwift (or RxJS as I had to π)
- For reactive teams – if your team uses RxSwift already in production I think the RxSwift book is also good to have. Whenever new person joins the team you are able to give him the book to read for a week to acquire essential knowledge to understand your code.
What if you are already familiar with RxSwift?
In this case, the book will be just a recap of what you already know.
What’s more, first chapters may be frustrating to you because when authors describe "filtering operators" they don’t use any other Rx solution which wasn’t mention in the book before.
It’s cool when you’re learning, but when you already know the stuff … you feel you want more π
How the book could be improved?
As I’ve already been using RxSwift in production I would like to see more advanced topics like custom schedulers or custom operators (from scratches) and how to write them.
Architecture is very important & interesting subject for me. Unfortunately, the book covers only the basics of MVVM π₯. First of all, I would like "Building a Complete RxSwift App" be bigger.
In my opinion, it misses error handling, retries, animations timing and so on. I also think the chapter called "Building a Complete RxSwift App" should have unit tests inside.
However, the chapter is already 20 pages long so there is much a knowledge inside. Maybe I just have a knowledge hunger? ππ .
Summary
Is the book worth to buy? yes, it is! π
For now, it’s the only complete source of knowledge about RxSwift. If you want to start or you’ve just started learning about Reactive programming and you don’t want to waste your time on searching google I think buying a book would be a good decision.
The book is well-written, English is simple so everyone will understand it, even if you aren’t a native speaker.
From technical point of view, the book stands on very high level. The book is written by 4 authors who really have the experience in RxSwift as also in iOS development in general.
Florent, Junior, Marin and Scott congratulations π – you did an awesome job!
So… if you want to buy the book… here it’s the link – Enjoy reading! ππͺ
… and hurry up! By the end of this week, the book costs $10 less ($44.99) than usual ($54.99)!
PS Finally, a sample chapter from RxSwift book is available! π You can find it here.
References
Title image β raywenderlich.com