Last active
July 2, 2019 21:57
-
-
Save dlemures/4b95d7fa0d62b0c548d91cc693cc3688 to your computer and use it in GitHub Desktop.
KTP
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
// Root | |
class FooActivity { | |
val bar: Bar by Inject() | |
fun onCreate(state) { | |
KTP.openScope("Scope Name") | |
.installModule(MyModule()) | |
.inject(this); | |
} | |
} | |
// Non-root | |
@InjectConstructor | |
class Bar(val d: Daniel, val s: Stephane) { | |
} | |
/* | |
1. `by Inject()` registers on a map<root, dependency> | |
2. openScope("Scope Name").inject(this) will go the map and set all the values. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment