Last active
May 16, 2016 19:36
-
-
Save danieljvdm/82aae48dad733873bd71e2232dbeedc9 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 Injectable { | |
associatedtype T | |
var viewModel: T! {get set} | |
mutating func inject(viewModel: T) | |
func assertDependencies() | |
} | |
extension Injectable { | |
func assertDependencies() { | |
assert(viewModel != nil) | |
} | |
mutating func inject(viewModel: T) { | |
self.viewModel = viewModel | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment