ralf
12/12/2021, 9:48 PM@Scope
. For example our scope annotation looks like that:
@Scope
annotation class SingleIn(val value: KClass<*>)
The usage side looks similar to this:
@SingleIn(AppScope::class)
@ContributesTo(AppScope::class)
@MergeComponent(AppScope::class)
Anvil wouldn’t be able to make the connection that @SingleIn
is the actual Dagger scope.dave08
12/13/2021, 10:58 AM@Scope
@AnvilScope
annotation class AppScope
?
I mean, that in a bunch of cases it just happens to be that all the classes are scoped in a certain sub/component... so that would save specifying the scope to Anvil... the only thing is that @ContributesTo()
is a bit funny 😅!ralf
12/13/2021, 5:55 PM@AnvilScope
though. With
@Scope annotation class AppScope`
you would write
@AppScope
@ContributesBinding(AppScope::class)
class YourClass @Inject constructor(..) : Abc
or
@ContributesTo(AppScope::class)
@Module
object YourDaggerModule
and
@MergeComponent(AppScope::class)
@AppScope
interface YourComponent
dave08
12/15/2021, 1:39 PMdave08
12/15/2021, 4:34 PMdave08
12/15/2021, 4:36 PMralf
12/15/2021, 5:25 PM@MergeSubcomponent
and then can contribute bindings and Dagger modules to this scope.dave08
12/16/2021, 3:58 AMdave08
12/16/2021, 4:00 AM@ContributesSubcomponent
, but I thought it did that? Also, when using it, it mentions using some kind of Factory annotation from Anvil instead of the dagger one, so it doesn't save the boilerplate?