Created
July 10, 2019 10:01
-
-
Save egek92/f3654df571cba65b9fd2a39e59dd45ed 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
// define scope in your module | |
module { | |
scope("scope_id") { Presenter() } | |
} | |
// use scope in your activity | |
class SomeActivity: AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
// ... other required stuff | |
// create the scope | |
val session = getKoin().createScope("scope_id") | |
// or get scope if already created before | |
val session = getKoin().getScope("scope_id") | |
// will return the same instance of | |
// Presenter until Scope 'scope_id' is closed | |
val presenter = get<Presenter>() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment