Hello guys, I'm using Koin Annotations in an
android project. Actually, I'm migrating it from Dagger/Hilt to Koin. I've migrated most parts except for couple of objects annotated with Hilt
@FragmentScoped
. How do I achieve this in Koin. This object is being injected to an AbstractFragment which has many concrete implementations. Here's the existing structure:
@Provides
@FragmentScoped
fun provideMarkwonEditor(markwon: Markwon): MarkwonEditor {}
@AndroidEntryPoint
abstract class AbstractNotesFragment(): Fragment() {
@Inject
lateinit var markwonEditor: MarkwonEditor
}
@AndroidEntryPoint
class FragmentA : AbstractNotesFragment()
@AndroidEntryPoint
class FragmentB : AbstractNotesFragment()
The way I thought I would implement is to do a
@Scope(AbstractNotesFragment::class)
and a
@Scoped
on the MarkwonEditor object, but I don't know if that will share the instance with FragmentA and FragmentB. What's the proper way to do this?