Untitled

mail@pastecode.io avatar
unknown
swift
a year ago
1.0 kB
1
Indexable
Never
let model = ChildBuilder.Model()
let viewController = ChildBuilder.build(model: model)

parentViewController.delegate = viewController
viewController.delegate = navigationController.topViewController as? ChildViewControllerDelegate

class ChildPresenter {

}

class ChildViewController {
    weak var delegate: ChildViewControllerDelegate

    func test() {
        delegate?.didTapItem(at: index)
    }

    func didTapChildPresenter() {

    }
}

extension ChildViewController: ParentViewControllerDelegate {
    func didTapToChild() {
        presenter.didTapChildPresenter()
    }
}

class ParentViewController {
    var delegate: ParentViewControllerDelegate

    func didTap() {
        delegate.didTapToChild()
    }
}

extension ParentViewController: ChildViewControllerDelegate {
    func didTapItem(at index: Int) {
        presenter.didTapSort(at: index)
    }
}

class ParentPresenter {
    weak var: delegate: ParentPresenterOutput?
}

extension ParentPresenter: ParentPresenterOutput {
    func didTapSort(at index: Int) {}
}