Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Local Koin application instance
- val mylocalKoinInstance = koinApplication {
- // declare used modules
- modules(
- module {
- single { ComponentA() }
- }
- )
- }
- // Custom KoinComponent using mylocalKoinInstance & not the Global context
- abstract class CustomKoinComponent : KoinComponent {
- // override the used Koin instance to use mylocalKoinInstance
- override fun getKoin(): Koin = mylocalKoinInstance.koin
- }
- // An example of component that use mylocalKoinInstance
- class MyCustomApp : CustomKoinComponent() {
- val a: ComponentA by inject()
- }
Add Comment
Please, Sign In to add comment