Deep Dive into Reactive Programming: My RxSwift Learning Journey

2020-02-12

In February 2020, as the “Waton App” project ramped up, I began systematically studying RxSwift. This was more than learning a new framework — it was an exploration of an entirely new programming paradigm: Functional Reactive Programming (FRP).

What Is RxSwift?

RxSwift is the Swift implementation of the ReactiveX idea. Its core philosophy is to treat everything as an observable sequence. A user’s tap events, a network response, or a simple array can all be abstracted into an asynchronous stream of events. All we have to do is **subscribe** to those streams and respond to the events they emit.

Core Concepts

As I studied, I gradually got a handle on several core RxSwift concepts:

  • Observables: the producers of events — over time, they emit a series of events.
  • Observers: the consumers of events — they subscribe to an Observable to receive and react to its events.
  • Operators: the essence of Rx. RxSwift offers a rich set of operators — map, flatMap, filter, zip, and many more — that let us compose, filter, and transform these asynchronous event streams much like arrays, making complex logic manageable.
  • Schedulers: control which thread an Observable emits on and which thread an Observer consumes on, greatly simplifying multithreading in iOS development.

Putting RxSwift to Work in the Waton App

While building the Waton App, I made heavy use of RxSwift and RxCocoa:

  • Used Driver to bind UI controls, ensuring UI updates always happen on the main thread and never terminate on error events.
  • Used flatMapLatest for search input, automatically cancelling the previous request to avoid wasted resources and out-of-order results.
  • Paired with the Moya networking library to turn API responses into Observables, handling asynchronous data in one unified, elegant way.

Learning RxSwift was a complete shift in mindset. It taught me to think in streams and to handle asynchronous logic declaratively — invaluable for writing complex iOS apps that are cleaner, more robust, and easier to maintain.