Kotlin Multiplatform Mobile(KMM)。我想使用 KMM 让我的 Android 应用程序在 iOS 上运行?
例如:有关问题的详细信息..我有一个使用 Kotlin 的 Android 应用程序项目。我想让我的 Android 应用程序使用 KMM 在 iOS 上运行。我还没有找到任何实时解决方案。如果您有任何实际示例可以让我的 Android 应用程序使用 KMM 在 iOS 上运行,那就太好了?
eg: details about the questions ..i have a android app project using Kotlin. I want to make my Android application work on iOS using KMM.i haven't found any live solution yet. it would be great if you've any practical example to to make my Android application work on iOS using KMM?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有神奇的工具可以做到这一点...
您可以按照以下步骤操作..
首先您应该将 java 代码转换为 kotlin 代码,
然后您应该将代码分为
业务层和表示层
您可以知道通过阅读干净的architecture Android
来了解它,然后我们将
业务层
放入Shared Module
然后我们将
表示层
放入ANDROID APP
中,然后应用程序将准备好在ios中使用他的业务逻辑
,然后您可以将您的swift代码写入
IOS APP
code>注意:
表示层
包含 view 、 viewmodel 和任何依赖于平台的工具,例如workmanger
业务层
包含network
和缓存
代码例如 KTOR 、 SQLDELIGHT 以及任何可能在 Android 和 Ios 之间共享的逻辑there is no magic tool to do this ...
you can follow this steps ..
first you should convert java code to kotlin code by
then you should separate your code into
business layer and presentation layer
you can know about it by reading cleanarchitecture Android
then we will put
business layer
intoShared Module
then we will put
presentation layer
intoANDROID APP
then application will be ready to use his business logic into ios
then you can write your swift code into
IOS APP
note :
Presentation layer
contain view , viewmodel and any Platform dependent tools likeworkmanger
business layer
containnetwork
andcaching
code like KTOR , SQLDELIGHT and any logic that may be shared betweenAndroid
andIos