Created
December 21, 2021 11:54
-
-
Save cp-hardik-p/f099380b513b64eec5a3127f4a6d3d48 to your computer and use it in GitHub Desktop.
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
| @InstallIn(SingletonComponent::class) | |
| @Module | |
| object NetworkModule { | |
| @Singleton | |
| @Provides | |
| fun provideRetrofit(): Retrofit { | |
| return Retrofit.Builder() | |
| .baseUrl("https://howtodoandroid.com/apis/") | |
| .addConverterFactory(GsonConverterFactory.create()) | |
| .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) | |
| .build() | |
| } | |
| @Singleton | |
| @Provides | |
| fun provideApiService(retrofit: Retrofit): ApiService { | |
| return retrofit.create(ApiService::class.java) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment