如何在 kotlin Multiplatform mobile 中使用模块

How to use module in kotlin Mutliplatform moblie

嘿,我正在学习 Kotlin 多平台移动版。我从doc. I successfully run the module in android and ios platform, without any problem. Now I want to implement this in real project. I successfully created the module inside my pre-existing android directory. According to this Make your cross-platform application work on iOS we can only use module inside the android directory. I work as android developer and my other team have ios developer. So the problem is we have different system for android and ios. So how can I share this module to the Ios team. Please guide me how to achieve this. I read somewhere ios need XCFramework开始学习。但我不确定,我怎样才能做到这一点。有人可以指导我一步一步吗?谢谢

一般来说,Kotlin Multiplatform Mobile 为您提供了为 iOS 构建框架的能力。它可以通过多种方式交付:

  • 简单的 ModuleName.framework 文件已准备好导入您队友的应用程序,
  • CocoaPods integration,让您的队友能够从源代码重建此框架并使用来自 Kotlin 代码的 third-party 库,
  • Universal (fat) framework and XCFramework。这两个旨在为框架用户提供为不同 CPU 架构构建结果应用程序的能力。这对发布应用程序很有帮助。

如果您的目标只是向 iOS 团队展示 Kotlin Multiplatform Mobile power 的示例,我认为 declare the framework 就足够了,通过执行适当的 gradle 任务并分享结果文件。
如果他们还想将一些代码放入模块的 iOS-specific 部分,添加 CocoaPods 集成将是个好主意。