I am thinking about what to use to perform network requests in KMM, given that the existing clients already have certain configurations and interceptions, and I was wondering if it makes sense having Ktor Client as layer on top of
OkHttp
and
NSUrlSession
with code like:
Copy code
// Android
public fun newHttpClient(nativeClient: OkHttpClient): HttpClient {
return HttpClient(OkHttp){
engine {
preconfigured = nativeClient
}
}
}
// iOS
public fun newHttpClient(nativeSession: NSURLSession): HttpClient {
return HttpClient(Darwin) {
engine {
configureSession { // how to do the same as Android?
}
}
}
}
I was wondering if someone uses this approach, and how does he/she configures the iOS
HttpClient
➕ 2
k
Karan Jhinga
12/13/2022, 10:39 AM
were you able to configure it?
d
diego-gomez-olvera
12/16/2022, 9:22 AM
no, I ended up using
expect
/
actual
for the networking with two implementations for now