<@U01EMBJSZHA> sorry for mentioning you. I’ve an ...
# multiplatform
l
@Rick Clephas sorry for mentioning you. I’ve an interface in the shared module which I plan to implement the interface in the respective App modules (not in ios, android packages of the kmm module)
Copy code
interface FetchTalkUseCase {
    suspend fun execute(talkID: String): Talk
}
When I use KMP-NativeCouroutines to generate native async methods, this interface generates the following header file
Copy code
__attribute__((swift_name("FetchTalkUseCase")))
@protocol DomainFetchTalkUseCase
@required

/**
 @note This method converts instances of CancellationException to errors.
 Other uncaught Kotlin exceptions are fatal.
*/
- (void)executeTalkID:(NSString *)talkID completionHandler:(void (^)(DomainTalk * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("execute(talkID:completionHandler:)")));
- (DomainKotlinUnit *(^(^)(DomainKotlinUnit *(^)(DomainTalk *, DomainKotlinUnit *), DomainKotlinUnit *(^)(NSError *, DomainKotlinUnit *)))(void))executeNativeTalkID:(NSString *)talkID __attribute__((swift_name("executeNative(talkID:)")));
@end;
Which when I implement in Swift code is as Screenshot. Is it working as intended? Can I restrict it to generate only the
async
type ignoring the completionHandler one? 🙇
r
Hey! At the moment KMP-NativeCoroutines doesn't support Swift to Kotlin cases. You can track the following issue for that: https://github.com/rickclephas/KMP-NativeCoroutines/issues/42. As a workaround you can annotate the function with
@NativeCoroutinesIgnore
. That will prevent the generation of
executeNative
. Regarding the async and completionHandler functions. That's an Xcode bug. If I am not mistaken you should be able to implement the completionHandler function and ignore the async one.
l
Got it! Thanks a lot 😀