Skip to content

Instantly share code, notes, and snippets.

@shabib87
Created June 12, 2019 18:24
Show Gist options
  • Save shabib87/502d3e83f66ffb85b47570a8a606abd9 to your computer and use it in GitHub Desktop.
Save shabib87/502d3e83f66ffb85b47570a8a606abd9 to your computer and use it in GitHub Desktop.
UI navigation using protocol oriented programming
protocol CanDisplayHeroDetailsScreen {
func displayHeroDetailsScreen(presenter aPresenter: Presenter)
}
extension CanDisplayHeroDetailsScreen where Self: UIViewController {
func displayHeroDetailsScreen(presenter aPresenter: Presenter) {
let detailsVC = HeroDetailsViewController.instantiateFromStoryboard(presenter: aPresenter)
navigationController?.pushViewController(detailsVC, animated: true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment