Albert-Gao / kotlin-native-mobile-multiplatform-example

Code sharing between iOS and Android with Kotlin native
52 stars 7 forks source link

Developing the ios(native) module. #4

Open khairilushan opened 6 years ago

khairilushan commented 6 years ago

Hi, First of all thank you for this example that you provided in this repo. Really help me to get started with Kotlin/ Native and MPP. I just want to ask you, what is the best workflow for now, for develop the iOS (Native) module. For example if I want to use the iOS framework API (NSUserDefaults, NSURLSession, etc), what is the best practice to work on it? Which IDE should I choose to work on this part, since seems like we can't work on this via IntelliJ (for now). If you have some tips regarding setup for these stuff, I would love to know that more.

Thank You so much.

Albert-Gao commented 6 years ago

Hi. Thanks for using the repo.

Can't say best practice because things continue getting better here in term of KN.

About IDE

About sharing code

I might be wrong because I am really not that kind of deep deep native expert who can re-invent the wheel in a concise way. xD

Brief

But KN really shines when you only embed all the very core business logic (without platform API). Like your model class and all the related logic.

So, the answer is yes, it works. I mean, write code and running on 2 platforms, but you should control it in a way that you can handle :)

Only my 2 cents, hope it helps.

khairilushan commented 6 years ago

Hi, Thank you so much for your response and that explanation. Currently Im trying to use it like this: So I have an expect class called NetworkService in my common module that I need to implement in both platform. So I want to use Retrofit for android and NSURLSession for iOS implementation.

But when I open this platforms/ios module in AppCode I can't get the auto-completion to worked. But If I create a K/N project via AppCode (Using the latest version) I can get the auto-completion worked. Do you know any workaround that I can use to develop this platform/ios module with the IDE support?

Once again, Thank you so much. :)

khairilushan commented 6 years ago

I got it worked now. So I need to include the platform:ios module into the iOS project by following instructions described here > https://github.com/JetBrains/kotlin-native/blob/master/MULTIPLATFORM.md#4-ios-application . So now I can open the iOS project in AppCode and develop the platform:ios along side with the iOS project with the IDE support. Thank You.

Albert-Gao commented 6 years ago

Really thanks for sharing the information !

skydsai commented 6 years ago

Thank you for this example that you provided in this repo.Really help me to get started with Kotlin/ Native.Can you tell me, how to build the ios app or create ios app in AppCode in KN?because I according to (http://developine.com/kotlin-native-ios-development-multiplatform-project/ and https://blog.csdn.net/xiangzhihong8/article/details/80630159) ,step by step but build failed or build empty view or nothing, please help me, would you provided AppCode Demo in KN,Thanks