Created
January 31, 2021 19:26
-
-
Save Rashidium/7885fa50ebdc187ea4c525f53dec0b10 to your computer and use it in GitHub Desktop.
FeedRouter with data passing
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
| import Foundation | |
| protocol FeedRoutingLogic: class { | |
| func routeToMovieDetail() | |
| } | |
| protocol FeedDataPassing: class { | |
| var dataStore: FeedDataStore? { get } | |
| } | |
| final class FeedRouter: FeedRoutingLogic, FeedDataPassing { | |
| weak var viewController: FeedViewController? | |
| var dataStore: FeedDataStore? | |
| func routeToMovieDetail() { | |
| let controller: MovieViewController = UIApplication.getViewController() | |
| controller.router?.dataStore?.movie = dataStore.selectedMovie | |
| viewController?.navigationController?.pushViewController(controller, animated: true) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment