RxSwift to Apple’s Combine “Cheat Sheet”
Get started with Apple’s Combine with your existing RxSwift knowledge
Update: This cheatsheet is available as a Markdown table, as well as searchable CSV tables in the following repo: https://github.com/freak4pc/rxswift-to-combine-cheatsheet. Thanks Joe Blau for the help and inspiration!
Update 2: I’ve released a library called RxCombine which provides a proof-of-concept for Bi-directional type bridging between RxSwift and Apple’s combine, letting you mix and match the two in your code as needed. I hope you’ll enjoy it! 😇 https://github.com/freak4pc/RxCombine
What a crazy WWDC week we’ve had! So many new things to learn and dig into :)
One of these new things was Combine, Apple’s asynchronous event-handling framework, now built into the OS. Unfortunately, since support is for iOS 13 / macOS Catalina and up, developers still have a long way to go until this can be used in production, but it’s still very exciting news overall to know Apple also believes this is a substantial and worthy programming methodology.
Myself, and Gett, are heavy users of RxSwift — so as part of my learning process, I’m trying to make a map of things that correlate directly between RxSwift and Combine. This will hopefully make the mental and actual migration process much easier to consume, and will hopefully assist you as well — the reader of this post!
Note: This is still a living and breathing post which will constantly be updated based on community feedback and Apple’s developing documentation, and will likely include some inaccuracies. See something I’ve missed? Whoops, Sorry! Feel free to leave a comment or reach out to me on twitter @freak4pc.
Also, the behavior of some of these operators are vastly different than RxSwift, but they are mostly the same in the context of their parent framework, and will get you in the same general direction.
¹ UIKit for Mac was just announced on WWDC for Catalyst. I believe RxSwift/RxCocoa will offer support soon enough. I also imagine Apple will bring Linux support at some point.
² SwiftUI offers much more than RxCocoa since the former is an entire UI Framework. I’m only comparing RxSwift & Combine’s UI binding capabilities.
Combine seems like a very promising piece of work by Apple engineers, and there’s no denying (looking at the list above) that it was heavily inspired by RxSwift (and ReactiveSwift as well) in its design, while incorporating some of their own thoughts and research into it.
I’m super excited to learn more about Combine and looking forward to iOS 13 arriving as soon as possible, so more and more iOS and Cocoa developers will finally be able to experience the joys of Reactive Programming.
Until next time, hope you‘ve enjoyed this quick recap. Feel free to leave a comment below or reach out to me on Twitter :-).