This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Coordinator { | |
var children: [Coordinator] { get set } | |
func start() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewsFeedCoordinator { | |
// #1 | |
func start(presenter: UIViewController) { | |
let newsFeedVC = NewsfeedViewController() | |
newsFeedVC.onCreateNewPostOptionSelected = { [weak newsFeedVC] in | |
guard let newsFeedVC = newsFeedVC else { return } | |
// #2 | |
self.showCreateNewPostFlow(presenter: newsFeedVC) | |
} | |
presenter.present(newsFeedVC, animated: true, completion: nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewsfeedViewController: UIViewController { | |
// … | |
func onCreateNewPostOptionSelected() { | |
// #1 | |
let createNewPostVC = CreateNewPostViewController() | |
self.present(createNewPostVC, animated: true, completion: nil) | |
} | |
// … | |
} | |
// … |