A (not so?) simple question … I’m targeting Android and iOS. I have a function in my shared code wh...
b
A (not so?) simple question … I’m targeting Android and iOS. I have a function in my shared code which takes a Coroutine Scope:
fun doSomeWork(withValue: Int, scope: CoroutineScope)
How would I call this from my swift code? More Context: In my swift code I have a
Task
, and I’d like to
doSomeWork
within the “scope” of the task
a
you could write an iOS safe fun like:
Copy code
fun doSomeWork(withValue: Int) {
doSomeWork(withValue,CoroutineScope(Dispatchers.Default))
}
And make the initial fun private.
then you call from ios:
Copy code
CoolFileKt.shared.doSomeWork(123)