Skip to content

Instantly share code, notes, and snippets.

@harmittaa
Created July 13, 2019 17:03
Show Gist options
  • Save harmittaa/0ec6b2479447b23c1682802fa88ecee5 to your computer and use it in GitHub Desktop.
Save harmittaa/0ec6b2479447b23c1682802fa88ecee5 to your computer and use it in GitHub Desktop.
Koin 2.0 and Retrofit 2.6.0 example
import com.github.harmittaa.koinexample.networking.WeatherApi
import org.koin.dsl.module
val forecastModule = module {
factory { WeatherRepository(get()) }
}
class WeatherRepository(private val weatherApi: WeatherApi) {
suspend fun getWeather() = weatherApi.getForecast()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment