I'm trying to create a shared interface for iOS an...
# multiplatform
z
I'm trying to create a shared interface for iOS and Android in kotlin multiplatform, and have this function that takes in a url. Is there a way I can make the iOS function take NSURL, but the android one take java.net.Url? Or should I just stick to String?
k
you can use an expect class with typealiases, but you may need a wrapper to unify the API, dependening on how you plan to use it
☝️ 5
z
that's genius. I'll have to try it out. thanks!
Just realized it's a part of the kotlin multiplatform documentation: https://kotlinlang.org/docs/reference/platform-specific-declarations.html (at the bottom). I really need to find some time and just read the whole thing.