Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Koin 1.0] - introducing new Android feature - scopedWith #142

Closed
arnaudgiuliani opened this issue Jun 8, 2018 · 0 comments
Closed

[Koin 1.0] - introducing new Android feature - scopedWith #142

arnaudgiuliani opened this issue Jun 8, 2018 · 0 comments
Labels
Milestone

Comments

@arnaudgiuliani
Copy link
Member

arnaudgiuliani commented Jun 8, 2018

Hello all,

for the next release 1.0.0, we are working on an interesting Android feature. The scopedWith() function will help you bind a lyfecycleOwner component (Activity, Fragment, Service ...) to a list of module paths. When the component receives a ON_DESTROYED signal, it will drop instances from given modules.

val appModule = module("org.koin.sample"){
     single { Presenter() }
}
class DetailActivity : AppCompatActivity() {
    
   override val presenter: Presenter by inject()
   
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        
        // Will drop Presenter instance after ON_DESTROYED signal
        scopedWith("org.koin.sample")
    }

This is interesting as it will help you bind Koin components on Android components lifecycle.

This feature is available in koin-android-scope version 1.0.0-alpha-16

@arnaudgiuliani arnaudgiuliani created this issue from a note in Koin Dev Board (Pinned) Jun 8, 2018
@arnaudgiuliani arnaudgiuliani changed the title Introducing Android scopeWith & new Koin Android projects Introducing Android scopedWith & new Koin Android projects Jun 8, 2018
@arnaudgiuliani arnaudgiuliani changed the title Introducing Android scopedWith & new Koin Android projects Introducing scopedWith feature & new Android projects Jun 8, 2018
@arnaudgiuliani arnaudgiuliani added this to the 1.0.0 milestone Jun 8, 2018
@arnaudgiuliani arnaudgiuliani changed the title Introducing scopedWith feature & new Android projects [Koin 1.0] - Introducing scopedWith feature & new Android projects Jun 8, 2018
@arnaudgiuliani arnaudgiuliani changed the title [Koin 1.0] - Introducing scopedWith feature & new Android projects [Koin 1.0] - Introducing scopedWith feature & renaming for Android projects Jun 8, 2018
@arnaudgiuliani arnaudgiuliani moved this from Pinned to Done in Koin Dev Board Jun 8, 2018
@arnaudgiuliani arnaudgiuliani moved this from Done to Pinned in Koin Dev Board Jun 8, 2018
@arnaudgiuliani arnaudgiuliani changed the title [Koin 1.0] - Introducing scopedWith feature & renaming for Android projects [Koin 1.0] - Android scopedWith & projects renaming Jun 8, 2018
@arnaudgiuliani arnaudgiuliani changed the title [Koin 1.0] - Android scopedWith & projects renaming [Koin 1.0] - introducing new feature: Android scopedWith Jun 9, 2018
@arnaudgiuliani arnaudgiuliani changed the title [Koin 1.0] - introducing new feature: Android scopedWith [Koin 1.0] - introducing new Android feature - scopedWith Jun 9, 2018
@arnaudgiuliani arnaudgiuliani moved this from Pinned to Done in Koin Dev Board Jun 9, 2018
@arnaudgiuliani arnaudgiuliani moved this from Done to Pinned in Koin Dev Board Jun 9, 2018
@arnaudgiuliani arnaudgiuliani moved this from Pinned to Done in Koin Dev Board Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant