We want to change my architecture from MVC to VIPER. I read basic tutorial by following http://mutualmobile.github.io/blog/2013/12/04/viper-introduction/
source code link : https://github.com/mutualmobile/Counter
- (void)createScreen
{
CNTCountViewController* view = [[CNTCountViewController alloc] init];
CNTCountPresenter* presenter = [[CNTCountPresenter alloc] init];
CNTCountInteractor* interactor = [[CNTCountInteractor alloc] init];
view.presenter = presenter;//object
presenter.view = view;//protocol
presenter.interactor = interactor;
interactor.output = presenter;
self.window.rootViewController = view;
}
Where for communication from viewcontroller ---> presenter is via preseter's object and presenter --- > viewcontroller throught delegate (protocol). I think this is to avoid retain cycles.
But i also went through one more tutorial https://www.objc.io/issues/13-architecture/viper/ source code link :https://github.com/objcio/issue-13-viper
where he used protocols only for both direction in VTDListWireframe
- (void)presentListInterfaceFromWindow:(UIWindow *)window
{
VTDListViewController *listViewController = [self listViewControllerFromStoryboard];
listViewController.eventHandler = self.listPresenter;//protocol
self.listPresenter.userInterface = listViewController;//protocol
self.listViewController = listViewController;
[self.rootWireframe showRootViewController:listViewController
inWindow:window];
}
Here
1)What is the advantage of using protocols in both direction ?
2)I observed that both protocol references are with strong property declaration in both classes.won't it lead to retain cycle ?