TheGreatWall icon indicating copy to clipboard operation
TheGreatWall copied to clipboard

How to Pass UIViewController instance to FeedListController?

Open cresouls opened this issue 6 years ago • 2 comments

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!

cresouls avatar Dec 03 '18 08:12 cresouls

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 :)

koromiko avatar Dec 07 '18 13:12 koromiko

Thank you so much @koromiko for your help. I will look into it. 👍

cresouls avatar Dec 13 '18 19:12 cresouls