Created
January 6, 2022 20:11
-
-
Save ericntd/ee2fb70b2695dbfc4e28327853c62c36 to your computer and use it in GitHub Desktop.
AppScope example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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