Created
January 6, 2022 20:18
-
-
Save ericntd/d9d52b6d86dbf4d42650322fbe5340f1 to your computer and use it in GitHub Desktop.
Dependency instead of Module 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