Created
December 1, 2015 15:28
-
-
Save eofster/3f8a5bff2796f165699a to your computer and use it in GitHub Desktop.
Wireframe and view controller factory
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 Wireframe { | |
| let navigationController: UINavigationController | |
| let viewControllerFactory: ViewControllerFactory | |
| init(navigationController: UINavigationController, viewControllerFactory: ViewControllerFactory) { | |
| self.navigationController = navigationController | |
| self.viewControllerFactory = viewControllerFactory | |
| } | |
| func presentPhotoDetailsWithPhoto(photo: Photo) { | |
| let vc = viewControllerFactory.createPhotoDetailViewControllerWithPhoto(photo) | |
| navigationController.pushViewController(vc, animated: true) | |
| } | |
| } | |
| // Usage | |
| let wireframe = Wireframe( | |
| navigationController: UINavigationController(), | |
| viewControllerFactory: StoryboardViewControllerFactory( | |
| storyboard: UIStoryboard(name: "Name", bundle: nil), | |
| context: NSManagedObjectContext(concurrencyType: .MainQueueConcurrencyType) | |
| ) | |
| ) | |
| wireframe.presentPhotoDetailsWithPhoto(Photo()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment