A detailed comparison of the two most popular Functional Reactive Programming frameworks for Swift: ReactiveCocoa vs RxSwift!
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1190-reactivecocoa-vs-rxswift
A detailed comparison of the two most popular Functional Reactive Programming frameworks for Swift: ReactiveCocoa vs RxSwift!
Ruy man, I’m sorry but your whole point about RxSwift is factually inaccurate … RxSwift does not provide UI bindings, maybe do some more research?
@icanzlib you should take another look at RxSwift’s source, specifically: https://github.com/ReactiveX/RxSwift/tree/master/RxCocoa/iOS
RxSwift provides extensive UI integration for UIKit, and limited support for AppKit.
@tonyarnold The UI support is in RxCocoa
I feel we are clutching at straws. RxSwift does provide UI binds. Is it via a sub project/repo? Well maybe, but the fact is if I pull down RxSwift I will have access to those. Not only that, the RxSwift organisation officially provides and maintain those. Unlike ReactiveCocoa, which offers them via the old objc API or in an un-official way via the Rex repo.
Edit: When I wrote this, I actually meant it as a plus (versus RAC).
@rperes please can you compare them in debugging, performance, library size, easy of use. I am RAC user and I feel all these is not in good shape for ReactiveCocoa. Is RxSwift better?
debugging - I think they would be equivalent. But I might be missing something from the RxSwift side, that would enable it to be better.
performance - RxSwift is faster based on my original benchmarks (GitHub - scotteg/ReactiveTesting: Project that implements the reactive tests created by RuiAAPeres) of course take this with a grain of salt.
library size - This depends. If you think about its core (not UI stuff), I think RAC’s implementation is smaller and simpler (more naive). (RxSwift here). On the UI side, RxSwift has RXCocoa versus RAC’s old objc API (that’s where the UI binds are). I am guessing that RxCocoa is smaller.
easy to use - I would say RxSwift, I think in its current state is more user friendly (documentation and how it is designed (Cold vs Hot signals + Parameterized Error)).
Re: debugging in RxSwift, in addition to using traditional debugging techniques, RxSwift also includes the debug()
method that will print out detailed info about every event, and RxSwift also tracks all memory allocations, which can be logged via RxSwift.resourceCount
.
It looks like the article is inaccurate about the types of events in RAC … from I know there are four types in ReactiveCocoa but the author claims there are only three. Check out this file for more information: https://github.com/ReactiveCocoa/ReactiveCocoa/blob/master/ReactiveCocoa/Swift/Event.swift
if you read the article carefully I say “three main events”. It was pointless to mention Interrupted
as it wasn’t going to add anything in that context.
I guess I will be the one to address the elephant in the room here.
The issue is not that @rperes has an opinion. Opinions are great! What kind of boring world would it be without them? Nor is it, really, that there are some inaccuracies. Nobody’s purfect.
I think the issue is that this article is undeniably a biased perspective (@rperes is a long-time RAC developer and recently became a core member of the ReactiveCocoa Org), and it is published on a site that has built its reputation on providing high-quality programming tutorials, which also implies an impartial, unbiased approach.
This article feels like an op-ed that may have found a better home on his own blog than here. If the intention was to create a truly unbiased and balanced comparison, on what clearly is a polarizing topic, the article should have been co-authored by both RAC and RxSwift advocates.
I appreciate that @rperes took the time to post a follow up on his own blog, appropriately titled, “Bias.” However, I feel compelled to respond to his closing comment. Not that I represent anyone else, but in that I have previously commented here, I want to clarify that I am not upset or angry with @rperes or anyone else.
If you’re new to reactive programming, welcome! You owe it to yourself to check out all available options–and there are other libs besides Rx and RAC–to see what feels right to you.
This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]