Commit 0028a424 authored by Wei Han's avatar Wei Han

code update

parent 6eda5646
...@@ -17,6 +17,7 @@ Pod::Spec.new do |s| ...@@ -17,6 +17,7 @@ Pod::Spec.new do |s|
s.dependency "React-Core" s.dependency "React-Core"
s.preserve_paths = "ios/QmsPluginFramework.xcframework" s.preserve_paths = "ios/QmsPluginFramework.xcframework"
s.vendored_frameworks = "ios/QmsPluginFramework.xcframework" s.vendored_frameworks = "ios/QmsPluginFramework.xcframework"
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
install_modules_dependencies(s) install_modules_dependencies(s)
end end
// ios/QmsPlugin/QmsPlugin.mm
#import <React/RCTBridgeModule.h> #import <React/RCTBridgeModule.h>
#import <ReactCommon/RCTTurboModule.h> #import <ReactCommon/RCTTurboModule.h>
#import <QmsPluginFramework/QmsPlugin.h> #import <QmsPluginFramework/QmsPlugin.h>
#import "QmsPluginSpec.h" #import "QmsPluginSpec.h"
@interface QmsPlugin : NSObject <RCTBridgeModule> @interface QmsPluginReact : NSObject <RCTBridgeModule>
@end @end
@implementation QmsPlugin @implementation QmsPluginReact
RCT_EXPORT_MODULE(); RCT_EXPORT_MODULE(QmsPlugin);
RCT_EXPORT_METHOD(multiplyAsync:(double)a b:(double)b resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
{
NSNumber *r = QmsPluginMultiply(a, b); // ✅ function call, no super
resolve(r);
}
- (NSNumber *)multiply:(double)a b:(double)b { - (NSNumber *)multiply:(double)a b:(double)b {
// Call into your XCFramework function NSLog(@"[QmsPlugin] multiply called with a=%f b=%f", a, b);
return QmsPluginMultiply(a, b); return QmsPluginMultiply(a, b); // ✅ function call, no super
} }
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule: - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams &)params (const facebook::react::ObjCTurboModule::InitParams &)params
{ {
return std::make_shared<facebook::react::NativeQmsPluginSpecJSI>(params); return std::make_shared<facebook::react::NativeQmsPluginSpecJSI>(params);
} }
@end @end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment