Skip to content

Instantly share code, notes, and snippets.

@saddahussain
Created May 22, 2019 11:16
Show Gist options
  • Save saddahussain/d7664d4d2209e280865f4d271023e2c6 to your computer and use it in GitHub Desktop.
Save saddahussain/d7664d4d2209e280865f4d271023e2c6 to your computer and use it in GitHub Desktop.
object RetrofitClient {
private const val BASE_URL = ""
private lateinit var retrofit: Retrofit
fun getClient(): APIService {
if (retrofit == null) {
retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
return retrofit.create(APIService::class.java)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment