https://kotlinlang.org logo
#touchlab-tools
Title
# touchlab-tools
b

brabo-hi

10/10/2023, 3:25 PM
Hello guys, when using
Skie
is there a way to create
SkieSwiftFlow
from
AsyncSequence
? From the documentation is says
Conversion from AsyncSequence to Flow is not yet supported
Is there any way around it?
r

russhwolf

10/10/2023, 5:08 PM
There's nothing built-in, but you could probably wire something up manually. eg
Copy code
// Kotlin
val kotlinFlow = MutableStateFlow<T>()

fun emitFromFlow(item: T) {
  kotlinFlow.emit(item)
}

// Swift
let sequence: AsyncSequence

for await item in sequence {
  emitFromFlow(item)
}
11 Views