Ribs: Complex modules

Created on 13 Nov 2017  路  9Comments  路  Source: uber/RIBs

Can you please provide some examples of complex modules with submodules and communication between them? (Rear menu, tableview with one cell - one module, etc)

question

Most helpful comment

@kovpas Since RIBs business logic driven, instead of view driven architecture, how you handle UINavigationController (back button taps, back swipe gesture) and UITabBarController(tab switches)?

All 9 comments

+1

I'd like to see an example about multiple states manipulating different ui components at the same ViewController, like: showing a button but hidding another.. Showing a view but hiding another..
Depending on each RIB state rules.

Thanks for reaching out @ManWithBear!

In general, there's no difference if two RIBs are a part of the same module or not. The only nuance is that the buildable, dependency, routing, and listener protocols and the RIB builder should become public. Other than that the code and communication should look the same.

@igordeoliveirasa have you had a look at the tutorials in the wiki - it will walk you through exactly what you are describing.

@sbarow Yes, i did it. But I think I was not able to explain what I really wish. Sorry. I'll keep practicing here.. Thanks!

@kovpas Since RIBs business logic driven, instead of view driven architecture, how you handle UINavigationController (back button taps, back swipe gesture) and UITabBarController(tab switches)?

+1

@ManWithBear in short, they are decoupled. Let's us UINavigationController as an example. When we want to push a new child VC, the parent router first attaches the child VC's corresponding RIB (router). Then the parent router tells the parent VC to "present" the child VC. In this case, the presentation is calling UINavigationController's push method. When the child VC is "popped" via either the back button or the swiping gesture, the child VC should be able to notify its parent VC by overriding the viewDidDisappear method. At this point, there's no more difference between tapping a custom button to dismiss a modal/embedded child VC. The parent VC can freely notify its corresponding router to detach the child RIB. The parent router needs to keep a mapping of which child VC maps to which child router. This can be achieved with some simple String IDs.

Closing as answered / stale.

Was this page helpful?
0 / 5 - 0 ratings