Is is possible to edit Kotlin/Native code in AppCo...
# kotlin-native
t
Is is possible to edit Kotlin/Native code in AppCode with autocomplete? I opened the KotlinConf spinner project and it shows unresolved references for
platform.*
, but has no issues compiling. If I open the same project in IntelliJ IDEA or Android Studio I don't get these errors and there is autocomplete. This basically makes editing the Kotlin/Native code impossible in AppCode and I would need to use IntelliJ IDEA or Android Studio just for the Kotlin files.
AppCode
o
Spinner is not written using MPP plugin, so there will be no autocompletion anywhere. Please use some other project, such as https://github.com/JetBrains/kotlin-mpp-example
t
@olonho thanks. The project you linked doesn't have Kotlin code in the iOS project but uses Swift for the Viewcontrollers, AppDelegate etc. Do you have an example which uses Kotlin for the view controllers as well, just like the spinner app?
I am considering using Kotlin for the whole iOS app for better interoperability with my "common" Kotlin module (e.g. suspend functions are not visible in Swift), but most samples have the iOS part in Swift. I'm not sure what would be better, to write the iOS part in Swift (with Kotlin as a C framework), or completely in Kotlin/Native. That's what I'm currently looking into before I start writing all the iOS code for my project.
t
@olonho thanks that looks interesting. Really appreciate your help. I also found the included template in AppCode (Kotlin/Native -> Application). This looks like a standalone Gradle project. Would it be possible to include this as a module in another Gradle project which already contains a "common" module? (and modules for Android, etc). If it try this, and open the iOS module in AppCode, it doesn't pick up the Gradle files.
This is how my project looks like. If I open the ios folder in AppCode, the AppCode doesn't pick up the gradle files. I think this is because the settings.gradle is a directory higher. Does this make sense?
I think I'll just write the iOS part in Swift and import the common module as a C framework. Looks like this is much easier than writing the app completely in Kotlin/Native. Was hoping I wouldn't have to deal with some c interop issues I'm having (generics, suspend functions) by writing the entire code in Kotlin..
s
IIRC AppCode still needs to use and Xcode project file. There is an article on raywenderlich.com about doing an all Kotlin iOS app written by someone in this slack. Sorry the name escapes me right now. It may help you out.
t
Thanks for the responses. The article is very interesting. I've decided to write the iOS UI code in Swift because it has better integration with storyboards and Kotlin/Native will probably just make it harder for me.