Created
January 31, 2018 12:15
-
-
Save Otbivnoe/e17f9ec4de99056bf8f59a98dd34bb60 to your computer and use it in GitHub Desktop.
This file contains 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 ProfileRoute { | |
var profileTransition: Transition { get } | |
func openProfile(for user: User) | |
} | |
extension ProfileRoute where Self: RouterProtocol { | |
var profileTransition: Transition { | |
return ModalTransition() | |
} | |
func openProfile(for user: User) { | |
let router = ProfileRouter() | |
let profileViewController = ProfileViewController(router: router) | |
router.viewController = profileViewController | |
let transition = profileTransition // it's a calculated property so I saved it to the variable in order to have one instance | |
router.openTransition = transition | |
open(profileViewController, transition: transition) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment