Skip to content

Instantly share code, notes, and snippets.

@catalinghita8
Created August 10, 2020 17:30
Show Gist options
  • Select an option

  • Save catalinghita8/89443babe6b2c39b4f808b30fbe0867e to your computer and use it in GitHub Desktop.

Select an option

Save catalinghita8/89443babe6b2c39b4f808b30fbe0867e to your computer and use it in GitHub Desktop.
class WeatherListFragment: Fragment() {
fun onCreate() {
val vm = DataViewModel(DependencyInjector.injectedRepoistory)
}
}
class WeatherItemDetailsFragment: Fragment() {
fun onCreate() {
val vm = DataViewModel(DependencyInjector.injectedRepoistory)
}
}
// Container of objects shared across the whole project
class DependencyInjector {
val injectedRepoistory = WeatherRepository(LocalDataClient(LocalDataBase()),
InMemoryDataClient(MemoryCache()),
RemoteDataClient(RetrofitCLient()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment