At my first job I had the privilege of working with an architecture that actively avoided the protocol-delegate pattern. One of the first things I actually did was refactor legacy code to remove that style. Moving away from that pattern allowed us to write code that was cleaner, more straightforward, and felt futuristic to be honest. I’m quite grateful for experiencing different coding styles, but particularly grateful I started off with a style on the bleeding edge that’s pretty cool.
Pipe Grid Isometric by Joe Ski
Here are some of the pros of RxSwift and cons of Combine I’ve come across.
Combine return types get messy. You have to use .eraseToAnyPublisher() to get the stream’s actual type. This isn’t necessary in RxSwift.
The type of a publisher is always AnyPublisher<A, Never>. In RxSwift, it’s just Observable<A>.
This doesn’t exist in Combine, but does in RxSwift.
I find I have to add .debounce() after all user actions while using Combine. Not sure why it registers ghost actions, but I’ve never had to do that with RxSwift. I’ve only used debounce when I wanted to limit the amount of network calls triggered by a text field.
You can add .rx to almost anything in RxSwift. It’s a little bit harder to make UI elements, built-in methods, etc. reactive in Combine.
I rebuilt login twice. This was a very long project. The first time around, I rebuilt it to use a function-based view model, the UI remained the same. It was a single page wherever users encountered it. I decided to redo it because I had just touched the page when adding Google sign in, and because senior people on my team would mention how old the architecture was and that it was a major flow in the app.
The second time around, a product manager wanted a new UI flow. My tech lead wanted me to break up my view…
I rebuilt size filtering. It previously had a functionality we weren’t happy with, but this component is really complex so it was left as is. We allow users to save sizes. In addition to modifying the functionality, I added a tab to the account page so users can modify their sizes. This project was crazy. I chose to have three pages use a single view model, but with slightly different inputs. The complexity was not reusing the view model, but more so maintaining an accurate state for all use cases.
This project I was pretty proud of, I think this is when I really started owning complex features. Previously, this tab only exposed listings from sellers a user followed, but it didn’t expose the actual list of sellers. My team had talked about how nice this would be, but at the time we thought it would be complicated to do. I went ahead and tried it anyway, fortunately it worked out. My team didn’t know that we had a user index on Algolia, but I found out that we did. I updated our Algolia infrastructure to paginate and index users. The result is a Followed Seller tab that exposes the sellers list and the sellers’ listings.