Hi, has anyone run into this error when trying out...
# swift-export
a
Hi, has anyone run into this error when trying out swift export with coroutines support?
Copy code
/Users/arsildo/AndroidStudioProjects/pazal-multiplatform/iosApp/  /Users/arsildo/AndroidStudioProjects/pazal-multiplatform/shared-ui/build/SPMPackage/iosArm64/Debug/Sources/OrgJetbrainsKotlinxKotlinxCoroutinesCore/OrgJetbrainsKotlinxKotlinxCoroutinesCore.swift:146:93 'OnCancellationConstructor' is not a member type of enum 'ExportedKotlinPackages.kotlinx.coroutines.selects'
im testing out kotlin = "2.4.0-RC-238"
I am trying to run a setup like this one here
Copy code
fun loadItems() = viewModelScope.launch {
    delay(timeMillis = 1000)
    _uiState.value = _uiState.value.copy(
        items = listOf(
            "Test1",
            "Test2",
            "Test3",
            "Test4",
            "Test5"
        )
    )
}

init {
    loadItems()
}
might be this
a
Hello there 🙂 Do you have a project to share with a reproducer?
t
I’m also running into the same issue. Looking forward to hearing any updates on this.
a
@tou do you have a reproducer to share? 🙂
t
Sorry, I’m currently migrating an existing project that uses Koin and KMP-NativeCoroutines to Swift Export, and that’s when I started encountering this issue. Unfortunately, I don’t have a minimal reproducible sample that I can share at the moment. sorry
a
That's understandable, thanks!
t
I understand now that exposing the
Job
is not a good practice. It seems better to keep the coroutine inside the method instead.
Copy code
fun loadItems() {
    viewModelScope.launch {
        delay(timeMillis = 1000)
        _uiState.value = _uiState.value.copy(
            items = listOf(
                "Test1",
                "Test2",
                "Test3",
                "Test4",
                "Test5"
            )
        )
    }
}