Skip to content

Instantly share code, notes, and snippets.

@ericntd
Created January 6, 2022 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericntd/ee2fb70b2695dbfc4e28327853c62c36 to your computer and use it in GitHub Desktop.
Save ericntd/ee2fb70b2695dbfc4e28327853c62c36 to your computer and use it in GitHub Desktop.
AppScope example
@DependencyHolder
class CatDependencyHolder {
@Provides
@AppScope
fun retrofit(): Retrofit {
return Retrofit.Builder()
.baseUrl(BuildConfig.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
}
@Provides
@AppScope
fun catApi(retrofit: Retrofit): CatApi =
retrofit.create(CatApi::class.java);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment