https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
i

ivan.savytskyi

03/06/2019, 6:43 PM
Hey folks, I’m trying to find out why for some classes defined on KN there is strange name generated (in header files), for example:
Copy code
__attribute__((swift_name("Kotlinx_coroutines_core_nativeCoroutineDispatcher")))
@interface MainKotlinx_coroutines_core_nativeCoroutineDispatcher : MainKotlinAbstractCoroutineContextElement <MainKotlinContinuationInterceptor>

__attribute__((swift_name("Ktor_client_coreHttpClientEngineConfig")))
@interface MainKtor_client_coreHttpClientEngineConfig : KotlinBase

etc.
And it looks weird on Swift side to have smth like this
public class UICoroutineContext: Kotlinx_coroutines_core_nativeCoroutineDispatcher
o

olonho

03/06/2019, 7:19 PM
Name conversion is documented in https://github.com/JetBrains/kotlin-native/blob/master/OBJC_INTEROP.md#name-translation, not sure what kind of strangeness you’re talking about.
i

ivan.savytskyi

03/06/2019, 10:34 PM
So from this
The names of Kotlin classes and interfaces are prefixed when imported to Objective-C. The prefix is derived from the framework name.
it means
Kotlinx_coroutines_core_native
is a name of coroutine native framework?
2 Views