ReactiveCocoa vs RxSwift

A detailed comparison of the two most popular Functional Reactive Programming frameworks for Swift: ReactiveCocoa vs RxSwift! By Colin Eberhardt.

Leave a rating/review
Save for later
Share
You are currently viewing page 3 of 3 of this article. Click here to view the first page.

Community

ReactiveCocoa has been around far longer than RxSwift. There are numerous people who could carry on with the work, a fair amount of tutorials about it online, and the Reactive Cocoa tag at StackOverflow is a good source for help.

ReactiveCocoa has a Slack group, but it’s small at only 209 people, so a lot of questions (by myself and others) go unanswered. In times of urgency, I am forced to PM ReactiveCocoa’s core members, and I assume others are doing the same. Still, you can most probably find a tutorial online to explain your particular problem.

RxSwift is newer, and at this time is is pretty much a one man show. It also has a Slack group, and it’s much larger at 961 members, and has more discussion volume. You can also always find someone to help you out with questions there.

Overall, right now both communities are great in different ways so in this category they are about even.

What Should You Pick?

As Ash Furrow said in “ReactiveCocoa vs RxSwift”:

“Listen, if you’re a beginner, it really doesn’t matter. Yes, of course there are technical differences, but they aren’t meaningful to newcomers. Try one framework, then try the other. See for yourself which one you prefer! Then you can figure out why you prefer it.”

I would advise doing the same. Only when you have enough experience will you appreciate the subtleties between them.

However, if you are in a position where you need to pick one and don’t have time to play with both, here’s my suggestion:

Pick ReactiveCocoa if:

  • You want to be able to better describe your system. Having different types to differentiate between hot and cold signals, along with a parameterized type for the error case, will do wonders for your system.
  • Want a battle tested framework, used by many people, in many projects.

Pick RxSwift if:

  • UI Binds are important for your project.
  • You are new to FRP and might need some hand-holding.
  • You already know RxJS or RxJava. Since they and RxSwift are all under the ReactiveX organization, once you know one, the others are just a matter of syntax.

Where to Go From Here?

Whether you choose RxSwift or ReactiveCocoa, you won’t regret it. Both are very capable frameworks that will help you to better describe your system.

It’s also important to mention that once you know RxSwift or ReactiveCocoa, jumping between one and the other will be a matter of hours. From my experience going ReactiveCocoa to RxSwift, as an exercise, the most troubling part was the error handling. Above all, the biggest mind shift is getting into FRP and not a particular implementation.

The following links should help you in your journey into Functional Reactive Programming, RxSwift and ReactiveCocoa:

I hope to see you use one of these great libraries in your future projects.

If you enjoyed what you learned in this tutorial, why not check out our RxSwift book, available on our store?

Here’s a taste of what’s in the book:

  • Getting Started: Get an introduction to the reactive programming paradigm, learn the terminology involved and see how to begin using RxSwift in your projects.
  • Event Management: Learn how to handle asynchronous event sequences via two key concepts in Rx — Observables and Observers.
  • Being Selective: See how to work with various events using concepts such as filtering, transforming, combining, and time operators.
  • UI Development: RxSwift makes it easy to work with the UI of your apps using RxCocoa, which provides an integration of both UIKit and Cocoa.
  • Intermediate Topics: Level up your RxSwift knowledge with chapters on reactive networking, multi-threading, and error handling.
  • Advanced Topics: Round out your RxSwift education by learning about MVVM app architecture, scene-based navigation, and exposing data via services.
  • And much, much more!

By the end of this book, you’ll have hands-on experience solving common issues in a reactive paradigm — and you’ll be well on your way to coming up with your own Rx patterns and solutions!

If you have any comments or questions, please join the forum discussion below!

Colin Eberhardt

Contributors

Colin Eberhardt

Author

Over 300 content creators. Join our team.