Artur Matsehor
10/03/2020, 9:11 PMdata class State @JvmOverloads constructor(
val loading: Boolean = false,
val data: ResponseBody? = null,
val error: ApiError? = null
)
In Swift, it is resolved to
init(loading: Bool, data: ResponseBody?, error: ApiError?)
Neither with overloads or default valuesdarkmoon_uk
10/04/2020, 11:08 AMRobert Jaros
10/04/2020, 12:12 PM@JsonTypeInfo
from jackson in the common source of MPP project? I have tried to create expected annotation like this:
expect annotation class JsonTypeInfo(val use: Id, val property: String) {
enum class Id {
CLASS
}
}
but actual typealias JsonTypeInfo = com.fasterxml.jackson.annotation.JsonTypeInfo
doesn't compile (fails with the Id enum class)rnett
10/05/2020, 1:43 AMimplementation(project(...))
.
The dependency block looks like:
val jsMain by getting {
dependencies {
implementation(project(":krosstalk-ktor-client"))
}
}
but causes (in kotlinNpmInstall
)
Error: Couldn't find package "krosstalk-krosstalk-ktor-client@1.0.3-ALPHA" required by "krosstalk-fullstack-sample@1.0.3-ALPHA" on the "npm" registry.
at MessageError.ExtendableBuiltin (C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:721:66)
at new MessageError (C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:750:123)
at PackageRequest.<anonymous> (C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:36539:17)
at Generator.throw (<anonymous>)
at step (C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:310:30)
at C:\Users\jimne\.gradle\yarn\yarn-v1.22.4\lib\cli.js:323:13
at processTicksAndRejections (internal/process/task_queues.js:97:5)
This was working fine before I published the package, and it works fine when I include it without using project
(i.e. implementation("com.rnett.krosstalk:krosstalk-ktor-client:$krosstalk_version")
)Aleksandr Ivanov
10/05/2020, 12:44 PMLiliia
10/05/2020, 2:09 PMrsetkus
10/05/2020, 3:35 PMJustin
10/05/2020, 7:09 PMdambakk
10/06/2020, 9:06 AMmike.holler
10/06/2020, 2:35 PMMaurice Jouvet
10/06/2020, 8:20 PM@Serializable
data class AccessModel(
val isAccessible: Boolean = false,
val conditions: List<ConditionModel>? = null
)
@Serializable
data class ConditionModel(
val id: Int,
val value: List<String>? = null,
val min: Float? = null,
val max: Float? = null
)
It's crashing here:
bindString(1, visibility?.let { database.FieldAdapter.accessModelAdapter.encode(it) })
fun accessModelToString(item: AccessModel): String = Json.encodeToString(AccessModel.serializer(), item)
val accessModelAdapter = object : ColumnAdapter<AccessModel, String> {
override fun encode(value: AccessModel): String = SharedJSONConverter.accessModelToString(value)
}
Here the object that's crashing.
{"conditions":[{"id":321,"value":["40"]}]}
Mathias Egekvist
10/07/2020, 6:16 AMTobi
10/07/2020, 3:46 PMktor
& kotlinx.serialization
to a multiplatform library, but I am not sure which version of the multiplatform dependencies I should use.
The android consumer of that library uses Kotlin 1.3.72
and I can't change that to 1.4.x
, yet.
My android library uses ktor 1.3.1
and kotlinx.serialization 0.20.0
, but if I apply those versions to the multiplatform dependencies, I am running into an Kotlin/Native error:
e: Could not find "/Users/X/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-serialization-iosx64/1.3.1/df889ad1b8cc9fc91850d7d320b61e95597b1ce7/ktor-client-serialization.klib" in [/Users/X/Documents/repos/multiplatform-graph, /Users/X/.konan/klib, /Users/X/.konan/kotlin-native-macos-1.3.70/klib/common, /Users/X/.konan/kotlin-native-macos-1.3.70/klib/platform/ios_x64].
Thanks in advance!edenman
10/07/2020, 6:31 PMKavita
10/07/2020, 7:25 PMmike.holler
10/07/2020, 8:13 PMkotlinx-coroutines-test
to help me with this, but unfortunately I ended up getting an error.
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
implementation("io.ktor:ktor-client-core:1.4.0")
}
}
val commonTest by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9")
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
Error:
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9.
Required by:
project :
Caused by: org.gradle.internal.component.NoMatchingConfigurationSelectionException: No matching variant of org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9 was found. The consumer was configured to find a usage of 'kotlin-runtime' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js', attribute 'org.jetbrains.kotlin.js.compiler' with value 'legacy' but:
- Variant 'apiElements' capability org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9:
- Incompatible because this component declares an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a usage of 'kotlin-runtime' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.js.compiler (required 'legacy')
- Variant 'runtimeElements' capability org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9 declares a runtime of a component:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.js.compiler (required 'legacy')
Big Chungus
10/07/2020, 8:57 PMmaven-publish
does for maven repsitories. It also setups your publications automatically from your JS compilations, yet allows for custom publications too. Give it a goo and let me know what you think!
https://gitlab.com/lt.petuska/kpm-publish/-/releases/v0.0.2
Slack Conversationdambakk
10/08/2020, 8:47 AM// Revert to just ios() when gradle plugin can properly resolve it
for adding the ios source set. Applying your “workaround” fixed my unresolved reference issues in iosMain. Do you know when the plugin will be fixed, or a ticket for the plugin I can follow the progress?Grzegorz Sagadyn
10/08/2020, 9:15 AM########### make call
first
second
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared AsyncCalc.$makeCall$lambda-0$FUNCTION_REFERENCE$0@9d0328 from other thread
Kotlin Code:
interface ApiCall {
fun get(url: String, success: (String) -> Unit)
}
class AsyncCalc(private val apiCall: ApiCall) {
fun makeCall() {
apiCall.freeze()
println("########### make call")
apiCall.get("<http://www.example.com|www.example.com>") {
println("########### $it")
}.freeze()
}
}
iOS impl:
let queue = DispatchQueue(label: "com.test.queue")
class ApiCalcImpl: ApiCall {
func get(url: String, success: @escaping (String) -> Void) {
print("first")
queue.async {
print("second")
success("hello")
print("third")
}
}
}
@main
internal class AppDelegate: UIResponder, UIApplicationDelegate {
let test = ApiCalcImpl()
internal func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
AsyncCalc(apiCall: test).makeCall()
return true
}
...
Max
10/08/2020, 1:03 PMMarc Knaup
10/08/2020, 4:38 PMInitialization script ‘/private/var/folders/wp/jsq85rms0tsf2h7x_9kqfztr0000gn/T/MigrationKt_main__.gradle’ line: 27
> Could not create task ‘raptorMigrationKt.main()’.
> Could not get unknown property ‘sourceSets’ for project ‘:raptor’ of type org.gradle.api.Project.It’s when I run a
main
function from IDE. The project is a JVM project and depends on a multi-module multiplatform library (raptor
) which is an included Gradle build.
Here’s the offending code generated by the IDE (the else
branch):mike.holler
10/08/2020, 9:52 PM.kt
and .java
files can exist side-by-side in the file system and you can access Kotlin functions from the Java file and vice versa. Are there any examples of doing that with JS? I'm talking within the same source set and file structure. I can't seem to figure it out.mike.holler
10/09/2020, 1:39 PM.js
as a npm package. I can call normal functions just fine in JS, but suspend
functions are a bit of an enigma from the .js
side. I know I can create a wrapper in jsMain
but I'd rather not manually do that for every suspend function. Is there any way to call a suspend function in JS and get a promise back (even if it requires a little helper function?)
Here is a modified version of the Base64 library example to show what I'm trying to do.
Kotlin Implementation
interface Base64Encoder {
@JsName("encode")
fun encode(src: ByteArray): ByteArray
@JsName("encodeToString")
fun encodeToString(src: ByteArray): String {
return encode(src).let { encoded ->
buildString(encoded.size) {
encoded.forEach { append(it.toChar()) }
}
}
}
suspend fun downloadAndEncodeToString(url: String): String {
return HttpClient().use {
it.get<HttpResponse>(url = Url(url)).readText()
}
}
}
JS Usage (see image below)Mustafa Ozhan
10/09/2020, 2:54 PMbackend
module into project as jvm
target but surprisingly backend Module is not seeing commonJvm
rather it sees commonAndroid
expected values. Also I can not reach the class in commonMain
from backend
module.
Did anyone had similar issue ?
You can see the gradle.kts files in threadMikołaj Kąkol
10/09/2020, 4:27 PMMutableStateFlow
is not suitable for MPP when multi-threading, since it will be frozen and crash. Any good replacement or knowledge if it will work eventually?
My case is that I would like on Native (iOS) watch for value changes and be able to notify kotlin code when Native would like to change value. It's would be okay to have two fields, one for reading and second for writing.Brady Aiello
10/10/2020, 9:29 PMChristian Sousa
10/12/2020, 4:09 PMThread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
Does anyone knows what might be causing this? This is not happening on our current implementation using 1.3.70, so it might be something that might’ve changed in this new release.
Any help would be really nice!
Thanks in advance!georg
10/12/2020, 6:10 PMSebouh Aguehian
10/13/2020, 8:10 AMFor both the application and tests you can set breakpoints and debug your code on iOS.I created a new project and added a single iOS test in the shared module. Stopping on breakpoints isn’t working.
import kotlin.test.Test
import kotlin.test.assertTrue
class IosTest {
@Test
fun test() {
assertTrue(false) // breakpoint here
}
}
peekandpoke
10/13/2020, 8:53 AM