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

tulio

08/31/2018, 8:55 AM
Hello guys, I’m trying to share some code between Android and iOS apps and my final goal is to have a completely detached kotlin project in a different repository that could generate a
jar
for android and a
framework
for iOS. Is there a way to do that currently with kotlin multiplatform/native? (the sample projects are all very coupled)
2
h

h0tk3y

08/31/2018, 9:40 AM
By completely detached, do you mean it should still be a single project for both Android and iOS, which is built separately from its usages, then published and consumed from a repository?
t

tulio

08/31/2018, 9:47 AM
Exactly… Just like a library. The consumers (Android and iOS) shouldn’t even know that kotlin was used to built it.
I could then upload the artifacts (jar and framework) to a maven repo and cocoapods/carthage
And I would be able to handle the library versions apart from the app versions.
h

h0tk3y

08/31/2018, 10:05 AM
At this point, you have to build a library and set up its publishing manually for each target. I couldn't find any sample with an iOS library published in the framework form, but there are a few samples with `*.klib`s published for the Kotlin/Native targets, such as
<https://github.com/Kotlin/kotlinx-io>
. Also, you may be interested in the new multiplatform projects model announced just above this post: it should provide a better code sharing and publishing experience (some publishing features are yet to come).
t

tulio

08/31/2018, 10:09 AM
Great @h0tk3y… I will have a look on those links carefully 🙂
Thank you
a

ankushg

08/31/2018, 6:59 PM
I'm also working on something like this for Android/Web/iOS. I'm only at the stage where I can spit out npm packages and jars though, so also following along to this thread for iOS Framework stuff 🙂
a

arne.stockmans

10/02/2018, 3:52 PM
We've just open-sourced our setup which includes publishing to CocoaPods / Bintray, hopefully it can still help you: https://github.com/novemberfiveco/kotlin-mpp-standard
🎉 1
2 Views