Last active
November 3, 2020 18:05
-
-
Save brunomunizaf/0aac434513ed584e6f42e820ff386aaa to your computer and use it in GitHub Desktop.
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 Pushing { | |
func push(_ target: UIViewController, from parent: UIViewController) | |
} | |
struct Pusher: Pushing { | |
func push(_ target: UIViewController, from parent: UIViewController) { | |
parent.navigationController?.pushViewController(target, animated: true) | |
} | |
} | |
protocol DashboardCoordinating { | |
func pushDashboardScreen(from parent: UIViewController) | |
} | |
final class DashboardCoordinator: DashboardCoordinating { | |
var pusher: Pushing = Pusher() | |
var dashboardScreenFactory: () -> UIViewController = DashboardScreen.init | |
func pushDashboardScreen(from parent: UIViewController) { | |
let screen = dashboardScreenFactory() | |
pusher.push(screen, from: parent) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment