Nicole Paprocki
04/19/2024, 2:52 PMclass ExampleClass<TRequest, TResponse> (private val suspendCall: suspend (TRequest) -> TResponse)
But in Swift/obj-c that gets compile to:
public class ExampleClass<TRequest, TResponse> : KotlinBase where TRequest : AnyObject, TResponse : AnyObject {
public init(suspendCall: any KotlinSuspendFunction1)
}
One workaround I thought of was instead of passing a lambda, I pass in an abstract class with that function, however Swift doesn’t support anonymous classes and I don’t want to have to define an explicit input class type each time I create the ExampleClass
. I can’t use protocols here either because obj-c doesn’t support generics.
If the suspendCall
constructor param in KMP isn’t a suspend fun, then the lambda code in Swift is generated fine, but when I add the suspend
keyword it’s not able to generate the async/await lambda. Does anyone have any ideas how to work around this?Mats-Hjalmar
04/19/2024, 5:55 PMNicole Paprocki
04/19/2024, 8:11 PMKotlinSuspendFunction1
which isn’t usable in swift (at least I don’t see how it can be used)Jacob Rhoda
04/22/2024, 6:23 PMNicole Paprocki
04/24/2024, 5:53 PM