Mastering MVVM With Swift

Why RxSwift

Before we refactor the AddLocationViewModel class, I would like to take a few minutes to explain my motivation for using RxSwift and RxCocoa. There are several reasons.

It's a Library

RxSwift is a reactive extension for the Swift language. ReactiveX has been gaining in popularity ever since Rx.NET was open sourced several years ago. Reactive extensions are available for many languages, including Java, C#, JavaScript, and Python.

What I like about ReactiveX is that it doesn't force you to adopt a particular architecture. You can use Rx without using the Model-View-ViewModel pattern. You should see Rx as a tool, not an architecture.


RxSwift has been around for quite a while. It is a robust implementation of the ReactiveX API and it is a joy to use it. The more you use RxSwift, the more you experience the power and versatility of ReactiveX.

The RxSwift team has invested heavily in testability, making it easy to test reactive code. Later in this series, we will test the reactive code we write. That will show you how important testability is.

Powerful and Versatile

While RxSwift has no relation to the Cocoa APIs, there is an extension for Cocoa, RxCocoa. Most of the UIKit components you use day in day out are reactified. In the next episodes, you find out what that means and what the benefits are.

The combination of RxSwift and RxCocoa is amazing. If you are new to RxSwift and RxCocoa, then I encourage you to give it a try. I hope the next few episodes can convince you to take a closer look at RxSwift and RxCocoa.

Next Episode "Integrating RxSwift and RxCocoa"