flight sky earth space

Start learning RxSwift today with these 6 steps

Getting to grips with RxSwift is not easy. There is a significant learning curve as you adjust your imperative mindset to a functional reactive one, with many new concepts to learn. So how do you get started?

(If you’re thinking “dude…it’s 2021…why would I want to learn RxSwift now we have Combine! Read my last article here)

I had been integrating bits and pieces of reactive code into the projects I’d been working on for the last few years. I’d solved a few problems using RxSwift, but felt as though I’d never fully got to grips with it. A year ago, I set out to finally conquer RxSwift. This is how I did it, and how you can do it too!

Buy this book – “RxSwift: Reactive Programming with Swift”

There are lots of great tutorials and blog posts out there, but from my experience they aren’t comprehensive enough to provide you with a solid foundation to begin your journey. This solid foundation is important. You need to fully grasp the basics before moving on to creating production code. So head over to the Ray Wenderlich website and order it now! 

Do it….right now. Go and place that order! I bought the paper version from Amazon but would highly recommend getting the digital version. I had a ton of notes scribbled on pages, and sticky tabs to bookmark sections. Plus you will find yourself referring back to it a lot! This is all far easier with the digital version. Plus you don’t have to wait for snail mail. Read the book from cover to cover. Work through all the sample projects and attempt the challenges.

Explore the RxSwift repo documentation and examples 

Checkout the Getting Started page. Now read through the other interesting mark down files in the documentation section. A lot of this you will already know from the RW book, but it’s a good idea to refresh your memory and there are some different things in there. Plus nothing feels better than thinking “Ah…I know this already!”. Now download the repo, open Rx.xcworkspace, and head to RxExample/RxExample and dig through the various examples. There are lots to choose from.

Join the RxSwift Slack community 

You are going to have questions along the way for sure! This is a very active community with lots of helpful members for when those questions pop up. It can also be very useful to see the questions other people ask, and the solutions that are suggested. Join here.

Build something!

This is the most important step. At this stage you should have a firm grasp of the knowledge required to code reactive applications in RxSwift. You have seen lots of theory, written some demo code and seen lots of examples. But the journey really begins when you start solving real coding problems. If you can do this in your day job then great! Alternatively, it could be a great idea to start a small side project, something simple, and build it from the ground up using your new found skills. 

The big question now is, how should you structure your app? This is a huge topic, with an endless list of possibilities. I wasn’t a huge fan of the example apps at the end of the Ray Wenderlich book. You may find that they are exactly what you are looking for, but here are my suggestions for places to look for inspiration.

  • If you like the flavour of MVVM, checkout this article. This provided something of a light bulb moment for me.
  • Likewise, go back to the RxSwift repo examples, and find the “GitHubSignup” example.

@danielt1263 has posted some great sample projects on GitHub, I found the following particularly useful:

  • RxSample, part of CLE-Architecture-Tools (Daniel’s latest demo for CLE)

Make sure you also checkout the huge list of projects on the RxSwiftCommunity GitHub for useful tools to use along the way.

Keep Coding

It will take some time to start to feel comfortable, and the only way to embed this new way of thinking is to keep solving problems. As mentioned above, experimenting with small side projects, or little demos of your own with limited functionality can be a great way to hone your skills.

An alternative (free) book – “Introduction to Rx”

I’m adding Introduction to Rx at the end simply because I personally got more value from this once I was already familiar with the concepts from the RW book. It’s written in C# so a great exercise to convert this to Swift code, but my feeling is that the learning curve can be steep enough. So best to start leaning in the context of Swift, without the extra load of converting from C# initially. Once you are comfortable though, this is a great resource. 

Zen Mind, Beginners Mind

As you head out on your journey to reactive mastery with RxSwift, you might get the disconcerting feeling that you’re a newbie once more, even after all these years. I know I certainly did! Embrace this humbling experience. We must push out of our comfort zone, to level up our skills and take our knowledge to the next level.

Stay in the Loop

Subscribe to tapdev and never miss a post.

Total
0
Shares
Previous Post
adult blur books close up

Is it worth learning RxSwift in 2021?

Next Post
river inside forest near brown leaf trees

How to bind button taps from custom cells to your view model

Related Posts
woman looking at the map

Convert array types using the map operator in Combine

In reactive programming, it's very common to require a stream of values in the form of an array. A typical use case for this is to populate a list with data. However, the array that is published from the source may need to be transformed to an array of values of a different type for display.
Read More