Skip to content

Instantly share code, notes, and snippets.

@alwarren
alwarren / RetrofitRepo.kt
Last active March 16, 2023 21:52
Using generics with Retrofit repositories. A work in progress.
package com.example.domain.api
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
open class RetrofitRepo<out S>(clazz: Class<S>) {
val service: S = Api.service(clazz)