Skip to content

Instantly share code, notes, and snippets.

@Rashidium
Created January 31, 2021 19:26
Show Gist options
  • Select an option

  • Save Rashidium/7885fa50ebdc187ea4c525f53dec0b10 to your computer and use it in GitHub Desktop.

Select an option

Save Rashidium/7885fa50ebdc187ea4c525f53dec0b10 to your computer and use it in GitHub Desktop.
FeedRouter with data passing
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