Aru Jeganathan
03/30/2025, 2:22 AM@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?arnaud.giuliani
05/07/2025, 1:29 PMI don't know if that will share the instance with FragmentA and FragmentBthen you need something else? like sharing at parent activity level?