Description
When using react
and redux
, there is a module called react-redux
that is the inspiration for ReRxSwift. Using that module allows you to cleanly separate stateful and pure components. I would like to make view controllers strictly pure as well, meaning that they have no explicit dependency on anything other than their props
and actions
. In the current form, this is broken by the requirement to have a connection
property in your view controller, which needs the application store as one of its parameters.
ReRxSwift can only be implemented if your view controller has two additional properties: props
and actions
. The current implementation uses protocol extensions to reduce the requirement to one single connection
property; props
and actions
are forwarded to the connection
instance.
In general, properties can be added to classes by defining subclasses, or by using the Objective-C runtime in the form of associated objects. I don't like the subclass-route, because if ReRxSwift would provide a ViewController
subclass that you have to use, you can no longer benefit from UITableViewController
, UICollectionViewController
, etc. And the Objective-C route is not desirable because it breaks Swift strong typing, and because I'm not convinced that it is very future-proof as a similar mechanism doesn't exist in Swift.
Do you have any ideas on how to improve this?