skydoves / TheMovies2

🎬 A demo project using The Movie DB based on Kotlin MVVM architecture and material design & animations.
Apache License 2.0
474 stars 58 forks source link

[Koin] No need for createdAtStart #2

Closed mradzinski closed 5 years ago

mradzinski commented 5 years ago

I think you got it wrong. By default Koin will behave lazily, so no need to set createdAtStart = false on each definition you don't wanna create during startup. I've also noticed some definitions don't have this property set, so I wonder if you thought not setting it would imply eager instantiation...

For example, here's Koin single DSL method. Notice createdAtStart:

    inline fun <reified T> single(
            qualifier: Qualifier? = null,
            createdAtStart: Boolean = false,
            override: Boolean = false,
            noinline definition: Definition<T>
    ): BeanDefinition<T>
skydoves commented 5 years ago

@mradzinski Oh, I thought the Koin will behave instantly instead of lazily, so I set createdAtStart = false on each definition. Thank you for your nice issue!

mradzinski commented 5 years ago

Very welcome 😊