Hi! Nice library, really like it!
But I can't get how we can do so called assisted injection. Imagine I have MyPresenter(val someId: Int, val interactor: SomeInteractor), where someId is dynamic parameter that is known only by the time MyView (a Fragment) is created.
How I can provide the MyPresenter in this case?
Hi Jeevuz! Thanks :)
I think, you have 2 ways to do it:
In Koin module
provide {MyPresenter(getProperty("someId"),get()) getKoin().setProperty("someId",/* your value */)Or if you use an MVP approach, you could directly set your id on your MyPresenter, by your fragment. Once your presenter is injected, fill your value presenter.someId = someId
try the first one if it fits your needs.
Thanks for the quick response!
Interesting way with the property.
Don't sure I understood your last point correctly. Is there the way to release the property? (It would be good for using the same property many times for different presenters. For example if I create first and put general PresenterParams for this and later release it and use for the second presenters creation.)
Properties cannot be dropped for now. But you overwrite existing property, each time you use getKoin().setProperty() on the same key.
袨泻, I got it. Thanks again!
Most helpful comment
Hi Jeevuz! Thanks :)
I think, you have 2 ways to do it:
In Koin module
provide {MyPresenter(getProperty("someId"),get())getKoin().setProperty("someId",/* your value */)Or if you use an MVP approach, you could directly set your id on your MyPresenter, by your fragment. Once your presenter is injected, fill your value
presenter.someId = someIdtry the first one if it fits your needs.