Last active
May 9, 2018 06:17
-
-
Save ileitch/82422913a3d0492e006ae6c6fc36a434 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 Injectable { | |
init() | |
} | |
class MyDependency {} | |
class MyClass: Injectable { | |
private let dep: MyDependency | |
required convenience init() { | |
self.init(dep: MyDependency()) | |
} | |
init(dep: MyDependency) { | |
self.dep = dep | |
} | |
} | |
class MyClass2: MyClass { | |
private let dep2: MyDependency | |
required convenience init() { | |
self.init(dep: MyDependency(), dep2: MyDependency()) | |
} | |
init(dep: MyDependency, dep2: MyDependency) { | |
self.dep2 = dep2 | |
super.init(dep: dep) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment