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

Theo

06/18/2020, 6:44 AM
I'm looking at integrating a third party dependency that I'd like to be able to call from my Kotlin framework, it currently only exists as an SDK for iOS and Android, I'm wondering what are some approaches you've used to structure something like this, do you just build an expect / actual wrapper around the third party sdk?
k

Kris Wong

06/18/2020, 1:18 PM
yes
s

Sam

06/18/2020, 1:20 PM
Another option is to declare interfaces in your library and have the calling app provide concrete implementations that wrap the platform library.
k

Kweku

06/18/2020, 1:21 PM
t

Theo

06/18/2020, 1:31 PM
thanks all, taking a look!
k

kpgalligan

06/18/2020, 8:34 PM
I would argue that the talk is more important than the library 🙂 https://vimeo.com/371460823
k

Kweku

06/18/2020, 8:40 PM
Question have you ever had come across a point where you couldn't wrap a library with expect actuals because of platform differences? In my case passing a lambda where one of the parameters was a interface on Android and a callback on Ios
k

kpgalligan

06/18/2020, 8:43 PM
There are always some differences. The firestore one had a weird thing where the same call was sync on ios and async on Android, so I had to kind of implement the async structure on iOS to give kotlin the same signature. In the firestore example, I use extensions to implement expect/actual because the underlying classes are always just a bit different.
2 Views