-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Original issue: uber/RIBs#303
From the tutorials it seems that the dependencies must be passed in to a child rib before you are ready to display said child Rib. What is the convention for passing data that will be needed by the child rib that is entered into (i.e: a textfield) the parent rib?
For example: -Rib A has a spinner picker that lets you pick one of 3 types (an address, a contact or a credit card) and a button that triggers Rib B. -Rib B displays a view to add an object of the type selected in Rib A. (Rib A is a table view with a cell that contains a text field for each component of the object type selected in Rib A) -How should that type be passed from Rib A to Rib B? The builder for Rib B which takes in the dependency/component is created when Rib A is created/displayed as this is done when Rib A's router is created. This is done before the user has selected a Type. Note: Trying to find a solution without Rx as our dev team is mainly comprised of junior developers and converting the project to Rx would add a lot of complexity that I don't think our team is ready to handle yet.
My current solution is to still create the builder for Rib B when Rib A's router is created however I pass the needed type through the protocol methods to Rib A's router and modified the .build() function to also take in that type which can then be passed to Rib B's interact and used to setup Rib B. However this feels like I'm passing in dependencies in two spots and doesn't seem like the ideal design, although it does work. This will become ugly if there are multiple values that need to be passed between views and would end up creating another "dependency" type object to pass to the child Rib.