Guest User

Untitled

a guest
Dec 15th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. // Local Koin application instance
  2. val mylocalKoinInstance = koinApplication {
  3. // declare used modules
  4. modules(
  5. module {
  6. single { ComponentA() }
  7. }
  8. )
  9. }
  10.  
  11. // Custom KoinComponent using mylocalKoinInstance & not the Global context
  12. abstract class CustomKoinComponent : KoinComponent {
  13. // override the used Koin instance to use mylocalKoinInstance
  14. override fun getKoin(): Koin = mylocalKoinInstance.koin
  15.  
  16. }
  17.  
  18. // An example of component that use mylocalKoinInstance
  19. class MyCustomApp : CustomKoinComponent() {
  20. val a: ComponentA by inject()
  21. }
Add Comment
Please, Sign In to add comment