kotlin-multiplatform

Kotlin Multiplatform: How to mock objects in a unit test for iOS

放肆的年华 提交于 2021-01-26 04:53:16
问题 I'm working on a Kotlin-multiplatform (KMP) library for iOS / Android. I have written some unit tests for JVM, for which I use MockK to create spies and mocks, but MockK doesn't support Kotlin native fully yet. Therefore, I was wondering how others working on KMP projects write unit tests for the iOS platform. An example would be really appreciated. 回答1: Currently, MockK does not support Kotlin/Native or Kotlin/JS. However, both are placed as important items on the project backlog: Kotlin

use a kotlin multiplatform lib in another kotlin multiplatfor lib

安稳与你 提交于 2021-01-05 07:10:14
问题 I have create a multiplatform kotlin librarie (L1)using intellij in gradle, who build in JS and JVM. I want to reuse this lib in another multiplatform kotlin lib L2 How can I do it? I have issue with importing the "common" part of L1 in the common target of L2, (the eror are a lot of Unresolved reference ), basicaly the common target of L2 cannot find the implementation contained in L1. I have only this issue with the common target, the js and jvm work fine. the gradle of L1, the lib to be

use a kotlin multiplatform lib in another kotlin multiplatfor lib

有些话、适合烂在心里 提交于 2021-01-05 07:09:33
问题 I have create a multiplatform kotlin librarie (L1)using intellij in gradle, who build in JS and JVM. I want to reuse this lib in another multiplatform kotlin lib L2 How can I do it? I have issue with importing the "common" part of L1 in the common target of L2, (the eror are a lot of Unresolved reference ), basicaly the common target of L2 cannot find the implementation contained in L1. I have only this issue with the common target, the js and jvm work fine. the gradle of L1, the lib to be

How to make a delay in Kotlin Multiplatform (pure kotlin)

廉价感情. 提交于 2020-12-30 09:37:04
问题 Is there an equivalent to JVM's Thread.sleep() in pure Kotlin for use on MPP projects? This could be implemented on each platform using expected , but I am asking about a solution that does not use that method. 回答1: This can be done using coroutines. For example: runBlocking { println("Wait for 5sec") delay(5000) println("Done waiting for 5sec") } 来源: https://stackoverflow.com/questions/55223336/how-to-make-a-delay-in-kotlin-multiplatform-pure-kotlin

How to make a delay in Kotlin Multiplatform (pure kotlin)

泄露秘密 提交于 2020-12-30 09:33:08
问题 Is there an equivalent to JVM's Thread.sleep() in pure Kotlin for use on MPP projects? This could be implemented on each platform using expected , but I am asking about a solution that does not use that method. 回答1: This can be done using coroutines. For example: runBlocking { println("Wait for 5sec") delay(5000) println("Done waiting for 5sec") } 来源: https://stackoverflow.com/questions/55223336/how-to-make-a-delay-in-kotlin-multiplatform-pure-kotlin

How to make a delay in Kotlin Multiplatform (pure kotlin)

徘徊边缘 提交于 2020-12-30 09:28:45
问题 Is there an equivalent to JVM's Thread.sleep() in pure Kotlin for use on MPP projects? This could be implemented on each platform using expected , but I am asking about a solution that does not use that method. 回答1: This can be done using coroutines. For example: runBlocking { println("Wait for 5sec") delay(5000) println("Done waiting for 5sec") } 来源: https://stackoverflow.com/questions/55223336/how-to-make-a-delay-in-kotlin-multiplatform-pure-kotlin

How to make a delay in Kotlin Multiplatform (pure kotlin)

筅森魡賤 提交于 2020-12-30 09:28:28
问题 Is there an equivalent to JVM's Thread.sleep() in pure Kotlin for use on MPP projects? This could be implemented on each platform using expected , but I am asking about a solution that does not use that method. 回答1: This can be done using coroutines. For example: runBlocking { println("Wait for 5sec") delay(5000) println("Done waiting for 5sec") } 来源: https://stackoverflow.com/questions/55223336/how-to-make-a-delay-in-kotlin-multiplatform-pure-kotlin

Not able to add iOS custom framework to a KMM (Kotlin Multi Platform) module (cinteropXXXIosArm64 FAILED module not found)

不想你离开。 提交于 2020-12-30 03:36:10
问题 I'm developing an iOS app, which makes use of a Kotlin Native share module. This Kotlin Native shared module, makes use of a self-developed iOS framework. This had worked very well in the past, but now I'm trying to upgrade my project for the last release of Kotlin Native (1.4.10 at this moment), Android Studio, and so on, and I'm not able to import my custom iOS framework dependency. The folder structure of the iOS framework is the following: Following the guide at https://kotlinlang.org

Not able to add iOS custom framework to a KMM (Kotlin Multi Platform) module (cinteropXXXIosArm64 FAILED module not found)

不羁岁月 提交于 2020-12-30 03:34:05
问题 I'm developing an iOS app, which makes use of a Kotlin Native share module. This Kotlin Native shared module, makes use of a self-developed iOS framework. This had worked very well in the past, but now I'm trying to upgrade my project for the last release of Kotlin Native (1.4.10 at this moment), Android Studio, and so on, and I'm not able to import my custom iOS framework dependency. The folder structure of the iOS framework is the following: Following the guide at https://kotlinlang.org

Android studio 4.1, Kotlin 1.4.20-RC, incorrect import syntax error display

廉价感情. 提交于 2020-12-15 04:14:33
问题 Android Studio 4.1 (AS) In a kotlin project, with a module that has android(), jvm(), and ios() multiplatform targets, I have an expected class in commonMain sourceset which has actual class implementations in androidMain and in jvmMain. The androidMain actual class shows an error in AS on the java imports: import java.text.DecimalFormat import java.text.NumberFormat import java.util.Currency The "java" in each line is red, as if the IDE can't see the dependency that resolves this. So of