In this post, I try to explain why using Redux with Swift is better idea [than MVVM].
What is Redux and Unidirectional Data Flow?
Redux is a flux implementation but slightly better implementation, it makes your application’s state more predictable. It first came out in Javascript world as a predictable state container for JavaScript apps with the powerful javascript library React.
Redux, simply makes your application’s state in single store object. So firing an action from your application/in view’s lifecycle state changes and your reducers for that action generate a new state.
Seyhun Akyürek at Medium
Replacing Redux in Swift with something better
Being a fantastic framework for development doesn’t come without a cost. Every time you update internal state in Redux, the entire interface re-renders. This isn’t a huge deal in most cases. But eventually you might have a situation where one update to state needs to be instantaneous (like using the keyboard shortcut to move from one message to the next), while another update is taking a while to compute (like processing hundreds or thousands of new message headers just downloaded from the email server). Since everything is managed in Redux’s development-friendly single unidirectional, single-threaded store, you get a frustrating lag.
Redux wasn’t designed with the opportunities native apps have, like multi-threading. And it wasn’t designed with the difficulties fully native apps have, like sharing some code among a separate mobile and desktop app, or having to do their heavy processing, database storage, etc., in-app, all while keeping the interface lightning fast.
Only when one chain lands at an interface component that is currently being used does it travel back up the tree and compute what it needs. But it only computes exactly what it needs, and this is all opaque to the code outside of the framework; it seems to work as though needed values have already been computed.
By declaring how each piece of state or interface reacts to other state changing, the framework is able to run each piece of your code only and exactly when it is needed.
Alex Obenauer at Medium.com
SwiftReactions Framework
What is Redux and Unidirectional Data Flow?
Redux is a flux implementation but slightly better implementation, it makes your application’s state more predictable. It first came out in Javascript world as a predictable state container for JavaScript apps with the powerful javascript library React.
Redux, simply makes your application’s state in single store object. So firing an action from your application/in view’s lifecycle state changes and your reducers for that action generate a new state.
Seyhun Akyürek at Medium
Replacing Redux in Swift with something better
Being a fantastic framework for development doesn’t come without a cost. Every time you update internal state in Redux, the entire interface re-renders. This isn’t a huge deal in most cases. But eventually you might have a situation where one update to state needs to be instantaneous (like using the keyboard shortcut to move from one message to the next), while another update is taking a while to compute (like processing hundreds or thousands of new message headers just downloaded from the email server). Since everything is managed in Redux’s development-friendly single unidirectional, single-threaded store, you get a frustrating lag.
Redux wasn’t designed with the opportunities native apps have, like multi-threading. And it wasn’t designed with the difficulties fully native apps have, like sharing some code among a separate mobile and desktop app, or having to do their heavy processing, database storage, etc., in-app, all while keeping the interface lightning fast.
Only when one chain lands at an interface component that is currently being used does it travel back up the tree and compute what it needs. But it only computes exactly what it needs, and this is all opaque to the code outside of the framework; it seems to work as though needed values have already been computed.
By declaring how each piece of state or interface reacts to other state changing, the framework is able to run each piece of your code only and exactly when it is needed.
Alex Obenauer at Medium.com
SwiftReactions Framework
Comments
Post a Comment