TheGreatWall
TheGreatWall copied to clipboard
How to Pass UIViewController instance to FeedListController?
Hi @koromiko, great tutorial.
I am wondering how we can pass ViewController instance to FeedListController. In many occasion, we need to push a viewController on didSelect. How can I achieve it without violating MVVM architectural rule?
Thanks in advance!
hi Sreejith, Thank you for your kind words :) Normally the viewController is actually pushed by the FeedListViewController. As for the implementation, we create a function in the FeedListViewController, which performs the push. Then we could create an Observable in the viewModel for receiving the events from the Controller. You might want to check this example, the viewModel.showAlertClosure does a similar thing. Hope this helps :)
Thank you so much @koromiko for your help. I will look into it. 👍