Is the RCT_EXTERN_METHOD not working in new arch? #36
-
|
I impl my biz in Swift, and export the api in *Exports.m like below @interface RCT_EXTERN_MODULE(ClassName, NSObject)
RCT_EXTERN_METHOD(doSomething:(NSDictionary *)map resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
@end I don't need to write a wrap method in OC handly, which RCT_EXTERN_METHOD helps me do that. The comment of RCT_EXTERN_MODULE tell all things about that. But I cannot see RCT_EXTERN_METHOD in this tutorial. Does that mean this method is not working any more in new arch? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @XuNeal, sorry for late response, I was on holidays. I moved it to Discussions tab, as it is more of a question rather than the issue with the tutorial. The difference between old and new arch on iOS is that, new arch introduces additional communication layer written in C++. Because, Swift & C++ interoperability is very limited at the moment, we cannot directly call Swift classes, methods, functions, etc. with C++ arguments - which might be the case in new arch (e.g. when you want to pass a JS object argument into your native module method). You can take a look at the "official" samples in react native community github, where
If Swift & C++ interoperability will be improved at some point, the |
Beta Was this translation helpful? Give feedback.
Hi @XuNeal, sorry for late response, I was on holidays. I moved it to Discussions tab, as it is more of a question rather than the issue with the tutorial.
The difference between old and new arch on iOS is that, new arch introduces additional communication layer written in C++. Because, Swift & C++ interoperability is very limited at the moment, we cannot directly call Swift classes, methods, functions, etc. with C++ arguments - which might be the case in new arch (e.g. when you want to pass a JS object argument into your native module method). You can take a look at the "official" samples in react native community github, where
Swift code is used in the same way as in the tutorial (via i…