Hi, I am creating a simple multiplatform project (...
# kotlin-native
r
Hi, I am creating a simple multiplatform project (Android, iOS) and I have a problem with UI CoroutineDispatcher for iOS. As Roman Elizarov mentioned in this thread https://github.com/Kotlin/kotlinx.coroutines/issues/462#issuecomment-429233477 I’ve added https://github.com/JetBrains/kotlinconf-app/blob/master/konfios/konfswift/ui/UI.swift dispatcher to my iOS app, but for some reason compiler says that
Kotlinx_coroutines_core_nativeCoroutineDispatcher
is undeclared. Moreover, I’ve spotted that if I go with the second solution https://github.com/Kotlin/kotlinx.coroutines/issues/470#issuecomment-414635811 everything works fine and
Kotlinx_coroutines_core_nativeCoroutineDispatcher
is declared properly. Why does
Kotlinx_coroutines_core_nativeCoroutineDispatcher
type disappears in the first approach? I am using:
Copy code
coroutines - '0.30.2-eap13'
kotlin_version = '1.3.0-rc-146'
Gradle version =  4.7
a
your kotlin project on native compiled into framework?
r
yes
a
in framework header file exist classes only used in your project directly. if in your project never used CoroutinesDispatcher in public api then in framework header class not appear
so you can use CoroutinesDispatcher in kotlin code like in second solution. or you can write in your project some public variable with tipe CoroutinesDispatcher and class will be available in swift
try just to add
val justValue: CoroutinesDispatcher? = null
somewhere in your kotlin project
after that in swift you should get
Kotlinx_coroutines_core_nativeCoroutineDispatcher
r
okay, thanks!