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

agustibm

10/18/2018, 7:10 AM
Hi! One question. The Kotlin multiplatform is only business logic? In other words, is it possible import dependencies, for example okhttp?
v

vincent.desmet

10/18/2018, 7:13 AM
You can import dependencies, but probably not the ones you want. OkHttp is built for JVM, so you can’t use OkHttp if you want to build to Native(e.g. iOS). But you should have a look at Ktor (http://ktor.io), a network server/client library by Jetbrains. They just released a beta version with multiplatform support.
1
a

agustibm

10/18/2018, 7:23 AM
Thank you. This tutorial will be useful http://ktor.io/clients/http-client/multiplatform.html?
And more things... is it possible the with js?
c

coletz

10/18/2018, 7:27 AM
yep the tutorial is useful. I've had a lot of problems with 0.9.5, while using 1.0.0 beta everything works
g

gildor

10/18/2018, 7:38 AM
it’s impossible to use Jvm dependencies, correct, but interesting that people from Square actually plan to make okhttp multiplatform, they already did it with okio Check this talk if you interested

https://www.youtube.com/watch?v=Q8B4eDirgk0

Slide from this talk about porting another libraries to multiplatform
For now you can use ktor client as multiplatform http client
a

agustibm

10/18/2018, 9:23 AM
Do you have an example uploaded? @coletz
Or @gildor
c

coletz

10/18/2018, 9:26 AM
nope, sorry. At the moment I don't have a completely working example, but you can check this one https://github.com/touchlab/DroidconKotlin/
woops sorry, ktor is not used here :S
s

Sergio Casero

10/18/2018, 11:15 AM
I have an example with mpp client
But I can't compile the JS project, for iOS and Android works
k

kpgalligan

10/18/2018, 12:17 PM
I talked about libraries a bit in my talk. Listed what's currently available for mobile dev. Should follow up with a post on that, but working on a new library. Only so much time. The droidcon app is strictly native mobile. No JS. Sqldelight should "run" on JS, but JS doesn't (officially) support sql. http://www.youtube.com/watch?v=Dul17VSiejo&t=24m0s
a

agustibm

10/18/2018, 2:05 PM
Thanks @Sergio Casero, but it haven’t ktor client, right?
s

Sergio Casero

10/18/2018, 2:06 PM
It has the ktor client common
a

agustibm

10/18/2018, 2:16 PM
sorry, it’s in feature/network_calls_common_client branch
s

Sergio Casero

10/18/2018, 2:17 PM
Yep!
5 Views