In my commonMain module I have a method to refresh...
# multiplatform
e
In my commonMain module I have a method to refresh some data from within a suspending context. Setting this method within android is straight forward as the suspending context is recognised, but when attempting to assign the variable from within Swift I'm facing issues as it's unable to map itself from a Kotlin Suspending function to a async function.
Copy code
var refreshSomeDataClass: suspend () -> SomeDataClass? = {
    null
}
Instead it is mapped to a 'any KotlinSuspendFunction0' which I can't simply assign to The error reads: "Cannot assign value of type '() async -> any KotlinSuspendFunction0' to type 'any KotlinSuspendFunction0'" Does anyone know how this can be achieved?
a
@ElliotSknr I can't say if it will be able to alleviate your specific problem, but in general when you want to be able to use Flows and Coroutines from Swift code, you will need to use either the SKIE plugin or the KMPNativeCoroutines plugin
e
I have the SKIE plugin installed, with none of the features disabled, but it doesn't seem to assist with any of the interop problems here unfortunately.
a
@ElliotSknr have you tried by using a named function instead of a lambda in a variable? Maybe that does a difference 🤞