Nacho Ruiz Martin
07/01/2021, 11:59 AMPaul Woitaschek
07/01/2021, 12:18 PMpublic fun runTest(suspending: SuspendingInterface) {
CoroutineScope(Dispatchers.Default).launch {
println(suspending.value())
}
}
public interface SuspendingInterface {
public suspend fun value(): Int
}
And ios switches threads:
class SuspendingInterfaceImpl : SuspendingInterface{
func value(completionHandler: @escaping (KotlinInt?, Error?) -> Void) {
DispatchQueue.global().async {
completionHandler(42, nil)
}
}
}
CoroutineTest.runTest(SuspendingInterfaceImpl())
That directly fails with:
kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared kotlinx.coroutines.internal.DispatchedContinuation@1f67dc8 from other thread
Nicolas Verinaud
07/01/2021, 1:46 PM- (NSString *) getSysInfoByName:(char *)typeSpecifier
{
size_t size;
sysctlbyname(typeSpecifier, NULL, &size, NULL, 0);
char *answer = malloc(size);
sysctlbyname(typeSpecifier, answer, &size, NULL, 0);
NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
free(answer);
return results;
}
And my Kotlin version :
private fun sysInfoByName(identifier: String): String? {
val size = cValue<size_tVar>()
sysctlbyname(identifier, null, size, null, 0)
var result: String? = ""
memScoped {
val value = allocArray<charfVar>(size.size)
sysctlbyname(identifier, value, size, null, 0)
result = NSString.stringWithCString(cString = value, NSUTF8StringEncoding)
}
return result
}
The result is always empty. 😞
Do you know why ? 😇andylamax
07/02/2021, 7:56 AMcommonMain
, and just for clarification, I write a couple of Java test in jvmTest/java
as well to make my self confident that my Java users won't scream at me
Question:
Is there a way that I can configure my kotlin multiplafrom library and write javascript (or even better, typescript) test in typescript that consume my kotlin lib? something like jsTest/javascript
or jsTest/typescript
?
Extended Question:
Can that be achieved similar to ObjC? C? say nativeTest/objectiveC
or nativeTest/C
Stefan Oltmann
07/02/2021, 2:03 PMexpect interface Image
expect interface ImageLoader {
fun loadFullImage(photo: Photo): Image
fun loadThumbnailImage(photo: Photo): Image
}
And for Android it should load a "ImageBitmap"
actual interface Image // ???
actual interface ImageLoader {
actual fun loadFullImage(photo: Photo): ImageBitmap
actual fun loadThumbnailImage(photo: Photo): ImageBitmap
}
And for iOS "Image" should be "UIImage" of course.
Is that possible?Alex Anisimov
07/02/2021, 2:51 PMxxfast
07/03/2021, 2:20 AMimport Foundation
class ViewModelDelegate : ObservableObject {
@Published var state: State = ViewModelsKt.DEFAULT_STATE
@Published var command: Command? = nil
init() {
subscribe(viewModel: ModuleKt.viewModel)
}
func subscribe(viewModel: ViewModel) {
viewModel.onChange { (state) in
self.state = state
}
}
}
is it possible to use Combine’s @Published
from kotlin side and get rid of this delegate all together?pravin
07/03/2021, 7:47 AMKareem Radwan
07/03/2021, 8:32 AMColton Idle
07/03/2021, 5:47 PMapp
module, and then a my_composables
module.
I converted the project to support kmm in order to get compose for desktop working. Now my_composables
is a kmm module with
androidMain
commonMain
desktopMain
main
I put a brand new HelloWorld
composable in common, and can now use that common composable in my app
module and desktopApp
module. All is good with the world AND I can slowly migrate my android only composables from main
into commonMain
.
That's my current strategy. Slowly migrate from main
into commonMain
. Is that "bad" or wrong? Should I just shove everything into androidMain
? Basically asking "is main
in a kmm module a bad pattern?"Akram Bensalem
07/04/2021, 3:40 PMimplementation("com.arkivanov.decompose:extensions-compose-jetbrains:0.2.6")
Any help ?alexandrepiveteau
07/04/2021, 10:51 PMkotlinx.serialization
, and targets both Kotlin/JS and Kotlin/JVM (with a Compose for Desktop client).
Compose for Desktop requires using Kotlin 1.5.10, but there’s a bugfix in kotlinx.serialization
for Kotlin 1.5.20 which I need for my Kotlin/JS target. Would there a way for me to fix my Gradle project and satisfy these two requirements ?
(code in 🧵)Robert Wijas
07/05/2021, 4:15 PMJason5lee
07/06/2021, 1:05 AMUnresolved reference: JvmInline
at compileKotlinMetadata
phrase. compileKotlinJvm
works fine.saket
07/06/2021, 6:09 AM> Task :common:linkDebugTestMacOS FAILED
e: Compilation failed: Deserializer for declaration public kotlinx.coroutines/cancel|8411479413341223858[0] is not found
* Source files:
* Compiler version info: Konan: 1.5.10 / Kotlin: 1.5.10
* Output kind: STATIC_CACHE
e: java.lang.IllegalStateException: Deserializer for declaration public kotlinx.coroutines/cancel|8411479413341223858[0] is not found
I’m already forcing all transitive dependencies of coroutines to 1.5.0-native-mt
by using:
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-native-mt") {
version { strictly("1.5.0-native-mt) }
}
predrag karic
07/06/2021, 10:00 AMEXC_BAD_ACCESS
when calling some use case. We are using clean arch and everything from domain layer is written in kotlin. We are manually freezing use case objects exposed to iOS.
I noticed this in log
/Users/teamcity/buildAgent/work/f01984a9f5203417/runtime/src/main/cpp/Memory.cpp:1581: runtime assert: add ref for reclaimed object
and this is in Xcode:
Thread 47: EXC_BAD_ACCESS (code=1, address=0x4aa017e2280)
Every use case have a callback and the only difference with other calls to common (kotlin) code is that in this situation I am calling another use case from that callback… not sure if that can be a root cause of this issue… Really appreciate if someone can help me how to figure out why is this happening and how to resolve it. Thx in advanceStefan Oltmann
07/06/2021, 12:20 PMBailey Pollard
07/06/2021, 1:09 PMAkram Bensalem
07/06/2021, 5:36 PMmiskalinn
07/07/2021, 11:22 AMBohdan
07/07/2021, 11:07 PMGuilherme Delgado
07/08/2021, 8:44 AMMartin Rajniak
07/08/2021, 12:26 PMTom Wayne
07/09/2021, 5:40 AMBradford Canonigo
07/09/2021, 8:15 AMMoshi
annotations.
I am having compile errors (Unresolved reference
) when using said data classes inside my KMM library.
I've read articles that says it doesn't support other serializing dependencies other than the kotlinx.serialization
.
Is there a way to convert moshi data class into a kotlinx.serialized class inside a KMM project?Simonas Brazauskas
07/09/2021, 9:16 AM.dSYM
for static frameworks? I am asking because when ios app crashes with kotlin native library, stack trace does not have anything useful. I have this from the symbolication documentation, but this only works with dynamic frameworks
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
binaries.all {
freeCompilerArgs += "-Xadd-light-debug=enable"
}
}
I am using sqldelight library with sqlcipher, and if library is static i do not need to link lsqlcipher
manually, otherwise if library is dynamic i need to link with either lsqlite3
or lsqlcipher
, but somehow it does not work and compiler complains that it cannot find lsqlcipher
. I have added sqlcipher as cocoapod
cocoapods {
this.ios.deploymentTarget = "13.0"
// Configure fields required by CocoaPods.
summary = "Secoris core"
homepage = "<https://github.com/JetBrains/kotlin>"
// You can change the name of the produced framework.
// By default, it is the name of the Gradle project.
frameworkName = binaryBaseName
pod("SQLCipher", "~> 4.4")
}
linking is done like this
targets
.flatMap { it.compilations }
.filterIsInstance<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation>()
.forEach { compilationUnit ->
compilationUnit.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlcipher")
}
but this gives following error ld: library not found for -lsqlcipher
. So in conclusion i am able to have encrypted database with sqlcipher if i use static library, with no linking needed, but then there is no .dSYM
for crash stack traces, or i can have .dSYM
with dynamic framework, but then sqldelight links to lsqlite3
and there is no encryption.iamthevoid
07/09/2021, 9:25 AMplugins {
id("com.android.application")
kotlin("android")
}
but when i move it to multiplatform library
plugins {
kotlin("multiplatform")
id("com.android.library")
}
compilation fails. Stacktrace in thread. buildFeatures.compose
enabled, composeOptions.kotlinCompilerExtensionVersion
set too. What am i do wrong?louiscad
07/09/2021, 1:31 PMbuild
on my machine (a MacBook Pro) was a long time ago and was very slow, ranging from 15 to 20 minutes… but now!
Now, okay, I upgraded the computer a bit in the meantime, but they're in the same ballpark: from Late 2013 MBP with i7 and 16GB of RAM to 2020 MBP 10th gen i5 and 16GB of RAM.
So now, it takes about 3 minutes, and I'm super happy, it'll make catching up and adding stuff much easier as I'll have the comfort of local feedback loops and IDE integration.
Thank you so much for making the Kotlin/Native compiler faster! 🙏🏼 ❤️Jason5lee
07/10/2021, 3:28 AMElyes Ben Salah
07/10/2021, 6:38 PMElyes Ben Salah
07/10/2021, 6:38 PMJohn O'Reilly
07/10/2021, 7:28 PMElyes Ben Salah
07/10/2021, 7:39 PMAbhishek Dewan
07/11/2021, 12:10 AMElyes Ben Salah
07/11/2021, 9:25 AMJohn O'Reilly
07/11/2021, 9:26 AMAdarsh Gumashta
07/11/2021, 9:27 AMJohn O'Reilly
07/11/2021, 9:27 AMElyes Ben Salah
07/12/2021, 9:34 AMkpgalligan
07/12/2021, 3:13 PMios()
vs iosX64()
(or similar), that may be what's happening here. "work in XCode" you mean you can run it from XCode? I haven't been building with the KMM plugin as much, so does it not run if it can't resolve everything in the IDE?Elyes Ben Salah
07/12/2021, 3:18 PMkotlin {
//android()
val isDevice = System.getenv("SDK_NAME")?.startsWith("iphoneos") == true
if (isDevice)
iosArm64("ios")
else
iosX64("ios")
targets.getByName<KotlinNativeTarget>("ios").compilations.forEach {
it.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlite3")
}
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
ios.deploymentTarget = "14.1"
frameworkName = "shared"
podfile = project.file("../iosApp/Podfile")
}
kpgalligan
07/12/2021, 3:19 PMElyes Ben Salah
07/12/2021, 3:20 PMtargets.getByName<KotlinNativeTarget>("ios").compilations.forEach {
it.kotlinOptions.freeCompilerArgs += arrayOf("-linker-options", "-lsqlite3")
}
kpgalligan
07/12/2021, 3:21 PMElyes Ben Salah
07/12/2021, 3:22 PM