Hacker News new | past | comments | ask | show | jobs | submit login

How do you feel about RxSwift and MVVM so far? Do you see it becoming increasingly more widespread in production code?



I think RxSwift and MVVM architecture work great together. I know some large companies that would keep it simple, would not use any framework. Some are stuck with legacy code, that requires lots of effort to change, but most of the time you will be asked about different architectures during an interview.

I would say it does not really what architecture is used, as long as it is easy to test, simple to add new features, any architecture will be fine.

From my point of view, I probably have a bit different approach to MVVM where we have Service layer (similar to Java Spring), below View Model, stick to the simple rules like single responsibility, separation of concerns, define your rules about communication between the architecture layers. RxSwift makes the communication between the layers so much easier, the old alternative would be using delegation pattern, notifications. In a large project over 30k lines delegation pattern will become painful to manage. Choose the right architecture for your project and don't be scared to add additional mechanisms, layers, because there is no solution that fits all.

With RxSwift concurrency is handled for you, you can do the heavy duty tasks in the background, observe on the main thread for ui updates. You can run multiple tasks in parallel and return the combined result. Things like these, become trivial to work with. Another benefit is that you will strive to write more functional code, functions that return observable that does one thing, and chain other observables, It wont be pure functional since most of the you will have side effects, which is fine. But still it is a good fight between the Object oriented paradigm vs Functional programming paradigm, finally you will settle with both and find a good balance.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: