Skip to content

Instantly share code, notes, and snippets.

@Wajahat-Jawaid
Created November 2, 2022 13:25
Show Gist options
  • Save Wajahat-Jawaid/91c61808c923b7bac9ed27a37c9e59c8 to your computer and use it in GitHub Desktop.
Save Wajahat-Jawaid/91c61808c923b7bac9ed27a37c9e59c8 to your computer and use it in GitHub Desktop.
/**
* Dependency Injection container at the application level.
*/
interface AppContainer {
val fileRepository: FileRepository
}
/**
* Implementation for the Dependency Injection container at the application level.
*
* Variables are initialized lazily and the same instance is shared across the whole app.
*/
class AppContainerImpl : AppContainer {
override val fileRepository: FileRepository by lazy {
FileRepositoryImpl()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment