根据文档

因此,K / N使用LLVM将Kotlin代码编译为iOS的本机代码。 Swift compiler also uses LLVM to optimize and generate machine code

  • 那么,在iOS平台上,已编译的K / N与已编译的Swift代码之间有什么区别吗?
  • 如果有的话,这些区别是什么?性能等

  • 最佳答案

    主要区别在于,为iOS编译的Kotlin代码带来了Kotlin / Native运行时,该运行时建立了Kotlin / Native内存模型,该模型旨在安全地保存全局对象的concurrencyimmutability,并且还为Kotlin对象提供了自己的垃圾收集器。
    否则,使用Kotlin / Native编译的代码确实具有双向interoperability with Swift,因为通常在iOS上使用的the Kotlin binary是可以使用import in one project with Swift的Objective-C框架。

    08-05 18:34