Skip to content

Instantly share code, notes, and snippets.

@tarunon
Created March 29, 2017 14:47
Show Gist options
  • Save tarunon/922dc1e58261484ea44962f209db4c22 to your computer and use it in GitHub Desktop.
Save tarunon/922dc1e58261484ea44962f209db4c22 to your computer and use it in GitHub Desktop.
protocol Injectable {
associatedtype Dependency = Void
func inject(_ dependency: Dependency)
}
extension Injectable where Dependency == Void {
func inject(_ depenency: Dependency) {
}
}
class VC: Injectable {
}
class VC2: Injectable {
typealias Dependency = Int
func inject(_ dependency: Int) {
print(dependency)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment