Marco Signoretto
02/18/2025, 5:15 AMFlow
using SKIE and we are implementing this interface on both Android and iOS, on iOS we are struggling to return the flow from swift side, I have this problematic snippet
func selectedPaymentMethod(paymentReference: KMPMotEngine.PaymentReference) -> KMPMotEngine.SkieSwiftFlow<SelectedPayment> {
let flow = KMPMotEngine.SkieKotlinFlowFactorySkieKotlinFlowFactory<SelectedPayment>().createSkieKotlinSharedFlow(replay: 0, extraBufferCapacity: 0)
Task {
for await value in self.delegate.selectedPaymentMethod(for: paymentReference.asSuperType()).values {
if let value { try await flow.emit(value: value.asKMP(paymentReference: paymentReference)) }
}
}
return KMPMotEngine.SkieSwiftFlow(flow)
}
We are consuming self.delegate.selectedPaymentMethod
which returns an Infallible
however if I use the Task
like this I have no way to call `Task.cancel()`I am not even sure it is even possible, does anyone have faced a similar issue of have any suggestion? it would be nice if somehow I could task.cancel()
when KMPMotEngine.SkieSwiftFlow
deinits