https://kotlinlang.org logo
m

marzelwidmer

04/05/2021, 2:12 PM
Hello I was just trining the following tutorial … https://kotlinlang.org/docs/multiplatform-library.html#create-a-project I was searching for a setup to create Shared Lib for
ios
and
android
and also
jvm
is there maybe a nice other tutorial to follow along 😞 this one I stumble with the Platform specific stuff.. I was trining to put the
Platforms
specific code from the
KMM Templated Sample
`
Copy code
import platform.UIKit.UIDevice
resp.
Copy code
actual val platform: String = "Android ${android.os.Build.VERSION.SDK_INT}"
I am not really the
gradle guru
😉
b

Big Chungus

04/05/2021, 2:47 PM
Commonizer (a tool that brings shared platform APIs to intermediate sourceSets) only works for native target groups. Your only option (for your set of targets) is to use commonMain with expect/actual.
You can also have a look at my template github.com/mpetuska/template-kmp-library
👍 1
m

marzelwidmer

04/05/2021, 5:30 PM
thanks I will take a look… 🙂
@Big Chungus is quiet new your template .. you have created already a lib with it 🙂 where I also can take a look….
b

Big Chungus

04/05/2021, 5:57 PM
The template comes with some sample classes and rests outlining the usage
Also sandbox module is a consumer playground
But the idea us that you get setup for ALL the platforms and then just remove what you don't need
👍 1
Although it is missing android setup since i have no experience in that. But for simple cases, you can publish an android lib as a jar (instead of aar)