I’m trying to implement something like `UI` dispat...
# coroutines
a
I’m trying to implement something like
UI
dispatcher from anko but on iOS My
build.gradle
Copy code
buildscript {
    ext.kotlin_version = '1.2.51'
    ext {
        coroutines_version = "0.25.0"
    }
}

apply plugin: 'kotlin-platform-native'

sourceSets {
    main {
        component {
            baseName.set("NF")
            outputKinds = [FRAMEWORK]
            target 'ios_arm64', 'ios_x64'//, 'ios_arm32'
        }
    }
}

dependencies {
    compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
    <...>
}
IosDisplayContext.swift
Copy code
import NF

@objc
class IosDisplayContext: NSObject, NFCoroutineDispatcher {

}
I’m getting error
Use of undeclared type 'NFCoroutineDispatcher'
. How can I implement public protocols of coroutines library by my Swift code?
e
You cannot. They are not exposed to Swift. You need to implement it in Kotlin, then compile the result (kotlinx.coroutines + your code) into a Swift framework for use in your Swift app.