Skip to content

Instantly share code, notes, and snippets.

@devDeejay
Created September 4, 2021 17:20
Show Gist options
  • Save devDeejay/263f75c68399ca483aa212bf83786bac to your computer and use it in GitHub Desktop.
Save devDeejay/263f75c68399ca483aa212bf83786bac to your computer and use it in GitHub Desktop.
// Hilt Module
// @InstallIn <-- We define the component (See Hilt Components for more)
// This helps Hilt knows how long these dependencies have to stay in the memory
// But We use the Application level component for this example
// So NetworkRepo() will stay as long as Application is running.
@InstallIn(ActivityComponent::class)
@Module
abstract class NetworkRepoModule {
@ActivityScoped
@Binds
abstract fun bindNetworkRepo(networkRepoImpl: NetworkRepoImpl): NetworkRepo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment