https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

rkeazor

05/08/2018, 12:28 PM
Is there any support for making network request with a multiplatform kotlin project
🤔 1
s

Sam

05/08/2018, 1:24 PM
Not built in. You would have to use an expect/actual class to make your network call and then use each platform’s method for making the network call.
a

agrosner

05/08/2018, 4:32 PM
What's nice is retrofit uses interfaces. So you in theory could use interface in common code that you only implement in iOS or js land
j

josephivie

05/08/2018, 7:38 PM
I'm working on one, but it's not done yet. If you don't need it immediately, I should be done with it by this weekend.
a

albertgao

05/09/2018, 5:49 AM
@agrosner Good idea. But
retrofit
like
room
, you need to use decorators, then it will pollute your model layer. So, any ideas for solving this? Extending the existing interface from
common
and decorate it in android? 🙂 I have my cross platform get() and post(), but thinking of using
retrofit
.
a

agrosner

05/09/2018, 1:45 PM
that might be valid. keeps the annotations away from other platforms. you can
expect
interface from common and actual it with decoration (i think thats possible)
what we need is a cross platform networking library, then retrofit's need is less when you use interface and implementation. rather than implementing each platform version differently
n

napperley

05/10/2018, 9:06 PM
In order for that to happen the solution would need to be written in Kotlin end to end (all platforms).
a

agrosner

05/10/2018, 9:07 PM
Yes and either support full reflection or kapt