Getting Started With RxSwift and RxCocoa

Use the RxSwift framework and its companion RxCocoa to take a chocolate-buying app from annoyingly imperative to awesomely reactive. By Ron Kliffer.

4.6 (87) · 2 Reviews

Download materials
Save for later
Share
You are currently viewing page 3 of 3 of this article. Click here to view the first page.

Where to Go From Here?

Download the completed version of the project using the Download Materials button at the top or bottom of this tutorial.

If you want a challenge, try adding a couple things to make this application even more reactive:

  • Change the CartViewController to use a reactive table view (instead of a label) to display the contents of the cart.
  • Allow the user to add or remove chocolates directly from the cart, automatically updating the price.

Now that you’ve gotten a taste of Rx programming, here are a few more resources to help you continue learning:

Finally, our own Marin Todorov has a great blog about his adventures in Reactive programming called rx_marin. Check it out!

If you enjoyed this tutorial, check out our RxSwift book, available in 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.
  • Much, much more!

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

Have questions or other Rx resources to suggest? Sound off below in the comments, or in the forums.