Swift-MVVMC-Demo
Swift-MVVMC-Demo copied to clipboard
How get controllers from a different coordinator ?
Suppose, I want a presented or pushed the PurchaseController on the FirstCoordinator, and also on the SecondCoordinator I will need a initialize the PurchaseController on the First and Second coordinator ?
@wojciech-kulik I did read your article about MVVM and Coordinator and implemented him on my project, and i like him, thanks 🙂
Yes, it's not a problem, you can instantiate PurchaseController from both coordinators or you can extract this code to another class and pass it as a dependency to your coordinator. However, I think the best approach is to create PurchaseCoordinator and start it as a child coordinator from FirstCoordinator and SecondCoordinator. Most likely you will implement there also some delegate, so you won't duplicate code this way ;)