hello i saw other way @Module @InstallIn(SingletonComponent::class) object RepositoriesModule {
@Provides @Singleton fun provideNewsRepository( apiService: NewsApiService ): NewsRepository = NewsRepositoryImpl ( apiService) } -
class NewsRepositoryImpl ( private val apiService: NewsApiService
) : NewsRepository {....
VS
@Module @InstallIn(SingletonComponent::class) abstract class RepositoryModule {
@Binds abstract fun bindNewsRepository( impl: NewsRepositoryImpl ): NewsRepository } -
class NewsRepositoryImpl @Inject constructor( private val apiService: NewsApiService
) : NewsRepository {....
Basically use bind for repos and singleton only for retrofit room
why not this way?