I have ViewControllers that are embedded in UINavigations and it would be awesome if we could have examples using them, not only modals.
Detailing forward and backward navigation.
@igordeoliveirasa I believe that you should implement back button functionality on your own, detaching current child from its parent router.
@oronbz thanks for your answer! I'll try this approach. However, I still have some doubts, like:
1 - Should I instantiate UINavigationController dynamically?
2 - This UINavigationViewController must be any kind of RIB component?
3 - A simple example really would help me.
Thanks.
1 - @igordeoliveirasa I would've create UINavigationViewController in my RootBuilder assign the Root RIB view controller as its initial view controller and then just present this navigationController on didLoad of the Root RIB.
2 - All the other RIBs views will just decide whether to present children as modals or push/pop to/from navigation controller.
3 - I'm not an UBER employee and just exploring this architecture as you do, I'm not really confident on giving you solid example, maybe UBER's employees will do.
@oronbz I don't know if its a good practice, however, the project I'm working starts with a default UIViewController (not UINavigationController) and after signed in, it presents a UINavigationController with its UIViewController children. Also, there are multiple other Storyboard UIViewControllers embedded to a UINavigationController.
@sbarow, Does current RIBs version support UINavigationController?
@oronbz On tutorials we have learned to create present(viewController: ViewControllable).
I guess it eliminates the chance about creating UINavigationController dynamically and pass it at that present method, since UINavigationController is not ViewControllable.
@oronbz I could solve creating the following extension:
extension UINavigationController: ViewControllable {}
Is that a good practice, @sbarow ? If it is, wouldn't be nice if UINavigationController were ViewControllable by RIBs design ?
Thanks.
There is nothing wrong with either approach. RIBs doesn't enforce what you can or can't pass around to do view presentation/navigation. You could go with the extension approach or you could change the present protocol function to rather take in a UINavigationController or pass a UIViewController/ViewControllable into the present method and then create a new UINavigationController with the root view controller being the passed in view controller.
We've seen approaches where navigating (the actual implementation) i.e pushing/presenting is done in either the Router or the ViewController - again RIBs doesn't enforce it, its up to you.
@sbarow Alright! I guess its less dirty to follow your other ideas instead of extending UINavigationController.
When you say: "We've seen approaches where .." <--- Where have you been seen them? I'd like to read more advanced open source projects using RIBs...
Thanks.
It's very complicated to discover the right way to use RIBlets when you have to sometimes navigate with UINavigateControllers and other times without, when you will detach you must know if you have do dismiss or to pop, when you have to use embedded modals and so on..
Tutorial helps a lot, however, I'm totally lost on real cases scenarios.
Where have you been seen them? I'd like to read more advanced open source projects using RIBs
I haven't seen ones yet. I think what @sbarow was referring to is our internal usage of RIBs: different teams might use them slightly differently.
I'm totally lost on real cases scenarios
I'll try to come up with a few simple UITabBarViewController and UINavigationController examples.
@kovpas I got it!
I'll try to come up with a few simple UITabBarViewController and UINavigationController examples.
Man, do that for us! It's really necessary! 馃憤
Thank you so much!
More info at #156
I think we could close this issue. I've learned how to use it properly.
@igordeoliveirasa it would be great if you can share a working example
@igordeoliveirasa @oronbz I've created a sample app to show all major use cases: https://github.com/dev4jam/ToDo
Closing as answered.
Most helpful comment
I haven't seen ones yet. I think what @sbarow was referring to is our internal usage of RIBs: different teams might use them slightly differently.
I'll try to come up with a few simple
UITabBarViewControllerandUINavigationControllerexamples.