Hello, Everyone I am trying Kotlin-Native because ...
# kotlin-native
n
Hello, Everyone I am trying Kotlin-Native because I am very interesting in creating multiplatform apps for iOS and Android. As soon as Kotlin-Native become available I tried to setup multiplatform project with common code module. - I created a Kotlin (Multiplatform-Experiment) project with IDEA. It had two platform specific modules - jvm (for Android) and js (I just ignore it) and common module. - Created new project in Android Studio and imported common and jvm module from previous step - Implemented project for android side. All UI code is in Android Studio project, code that supposed to be common - in common module. For logic that supposed to be platform specific common module use expect class syntax and those classes implemented in jvm module. Now, I wanted to implement iOS part in AppCode. How I should import common module and implement platform specific logic? Or maybe I am doing it all wrong and multiplatform project should be implemented using different flow? I tried to look into Spinner App from Kotlin Conference, but it's so big for me where are many parts and I can't understand how to implement only two projects for client-side. Thanks for your help.
a
Had similar problem when I started working on mine. Note that mine was a more specific game project that doesn't use many platform specific APIs. This is what I did: https://medium.com/@anaredmond/cross-platform-game-project-setup-3-of-1b544cbad84a
s
I'm going to write a blog post on this, but the long and the short is that AppCode doesn't play nicely with Android Studio or IntelliJ, so it's best to keep them completely separate. Here is the direction we are headed:
Copy code
/root folder
  -/iOS (AppCode Folder)
    -/feature
    -/modules
    -/target
      -/target-ios
  	-/.xcodeproj
  	-/<Application Folder>
  	  -/<root gradle dir>
  -/android (For Android and common code modules)
    -/feature
  	-/modules
  	-/target
  	  -/target-android
  -/shared.gradle
The iOS and android folders have 2 separate gradle projects, but the iOS gradle project will also include the common modules in the android side. Common code / Android code will be edited from the android folder using IntelliJ or android studio, and app code will only handle the iOS specific stuff. This approach is counting on eventually merging the iOS and android folders together once the kotlin IDE is released. If that wasn't the case, perhaps it'd be best to have 3 separate folders (one additional for common), and 3 separate IDEs.