Last active
October 13, 2020 11:31
-
-
Save arnaudgiuliani/6715cfd92cbca0e20f6acfb6610cc7c9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Implementing our own Scope delegation | |
| class MVPActivity : AppCompatActivity(R.layout.mvp_activity), KoinScopeComponent { | |
| // Create scope | |
| override val scope: Scope by lazy { newScope() } | |
| // Inject presenter with org.koin.core.scope.inject extension | |
| // also can use directly the scope: scope.inject<>() | |
| val presenter: ScopedPresenter by inject() | |
| // Don't forget to close it when finish | |
| override fun onDestroy() { | |
| super.onDestroy() | |
| scope.close() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment