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

Steven

12/05/2018, 6:24 PM
all i want to do is use a kotlin multiplatform lib on an xcode project. in the tutorial here https://kotlinlang.org/docs/tutorials/multiplatform-library.html they mention “Now check it with the command ./gradlew publishToMavenLocal and you should see a successful build. That’s it, our library is now successfully published and any Kotlin project can depend on it, whether it is another common library, JVM, JS, or Native application.” Can you use a maven dependency on an xcode project? Sorry for noob questions 🙂
r

russhwolf

12/05/2018, 6:33 PM
You consume the maven dependency from kotlin native. Then you can produce a framework from that via gradle and import that framework into your xcode project.
s

Steven

12/05/2018, 6:55 PM
i see. are there any examples of this?
k

kevinskrei

12/05/2018, 8:16 PM
I was using this to generate an apple framework: https://kotlinlang.org/docs/tutorials/native/apple-framework.html
kotlinc-native lib.kt -produce framework -target ios_x64 -output iOS_sim/Demo
Or if you follow this: https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html the shared code project will generate an xcode framework in the builds folder
j

Jaroslav

12/06/2018, 6:38 AM
or if you just want to use your library without actually publishing it, you can use something like this:
pod 'myLib', :path => '../../my_lib/'
v

vincent.desmet

12/06/2018, 8:06 AM
@Steven We recently published a Kotlin MPP standard project which publishes the iOS library to Cocoapods. https://github.com/novemberfiveco/kotlin-mpp-standard#publishing-your-ios-library-to-cocoapods
s

Steven

12/06/2018, 12:37 PM
thank you very much everyone for your help! I can’t wait to try your suggestions. Will update here when i get it working! 😄

https://media.giphy.com/media/9K2nFglCAQClO/200.gif

🎉 1
thank you all very much for your help!
4 Views