Kotlin/Native support using expect-actual across modules?

This issue is previously posted here How to use expect-actual across modules? · Issue #56 · JetBrains/kotlinconf-app · GitHub but got no reply, so I reposted it here.

In the old blog Multi-platform Projects with Kotlin – Hadi Hariri, it talked about how to use expect in the common module, and implement it with actual in separated android/js module. Also, sample code here GitHub - hhariri/kotlin-mpp-sample: Sample Multiplatform Kotlin Project

In this repo (considered the latest tech to use kotlin/native in the multiform platform), the actual implementation must be essentially implemented in the same ‘:common’ module, which is kinda awkward.

Here is my scenario.

In this repo, there is an interface org.jerbrains.kotlincof.storage.Settings declared in the common module, and implemented in the Android module and ios sourceset which is also in the common module.

I’m trying to change the interface to expect-actual, since the Settings interface only has one implementation on one platform. Only to find I have to do actual Settings in the jvmMain sourceset, like this.

image

I want to implement the Settings in my android/ios module for multiple reasons:

  1. my Settings implemetation depends lots of Android librarys
  2. my Settings implemetation depends lots of Android module source code
  3. my Settings implemetation depends on my Android application config

There is one problem: when using expect-actual across modules, one must implement actual in the ios module and possibly in Swift/Objective-c, which make it impossible for kotlin compiler to enforce the actual implementation.

BTW(小声BB): If we could write kotlin file in swift module like writing kotlin file in java module, that would be perfect.

Thanks in advance!