John O'Reilly
10/01/2024, 8:33 AMinterface SomeKotlinInterface {
suspend fun someMethod()
}
Is it expected that swift class that implements that interface would look like follwing?
class SomeKotlinClass: SomeKotlinInterface{
func __someMethod(completionHandler: @escaping ((any Error)?) -> Void) {
<#code#>
}
func __someMethod() async throws {
<#code#>
}
}
Filip Dolník
10/01/2024, 8:37 AMJohn O'Reilly
10/01/2024, 8:38 AMFilip Dolník
10/01/2024, 8:42 AMfunc __someMethod(completionHandler: @escaping ((any Error)?) -> Void)
is the real Obj-C function as declared in the header.
func __someMethod() async throws
is an automatically converted signature of the same function. If you implement it, you actually provide implementation for the first function and Swift will take care of converting it back during compilation.John O'Reilly
10/01/2024, 8:43 AMTadeas Kriz
10/01/2024, 1:00 PMasync
, it’s actually not participating in cooperative concurrency and won’t support cancellation.