Last active
November 19, 2019 07:27
-
-
Save ericlewis/2f901fe827b45981b2897de6bf804b0d to your computer and use it in GitHub Desktop.
Codegen experiment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* RCTNativeTestModuleSpec.h | |
* | |
* NOTE: This file is codegenerated. | |
*/ | |
#import <vector> | |
#import <Foundation/Foundation.h> | |
#import <React/RCTBridgeModule.h> | |
#ifdef RN_TURBO_MODULE_ENABLED | |
#import <jsireact/RCTTurboModule.h> | |
#endif | |
/** | |
* The ObjC protocol based on the Typescript type for TestModule. | |
*/ | |
@protocol NativeTestModuleSpec < | |
RCTBridgeModule | |
#ifdef RN_TURBO_MODULE_ENABLED | |
, | |
RCTTurboModule | |
#endif | |
> | |
- (void)testVoid; | |
- (double)testingNumber:(double)a; | |
- (double)testMulti:(double)a c:(double)c; | |
- (void)testIdk:(NSString *)a; | |
- (NSString *)testString:(NSString *)a; | |
- (NSString *)testLotsOfThings:(NSString *)a c:(double)c b:(double)b; | |
@end | |
#ifdef RN_TURBO_MODULE_ENABLED | |
namespace facebook { | |
namespace react { | |
/** | |
* The iOS TurboModule impl specific to TestModule. | |
*/ | |
class JSI_EXPORT NativeTestModuleSpecJSI : public ObjCTurboModule { | |
public: | |
NativeTestModuleSpecJSI(id<RCTTurboModule> instance, std::shared_ptr<JSCallInvoker> jsInvoker); | |
}; | |
} // namespace react | |
} // namespace facebook | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* RCTNativeTestModuleSpec.mm | |
* | |
* NOTE: This file is codegenerated. | |
*/ | |
#ifdef RN_TURBO_MODULE_ENABLED | |
#import "RCTNativeTestModuleSpec.h" | |
namespace facebook { | |
namespace react { | |
static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_testVoid(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { | |
return static_cast<ObjCTurboModule &>(turboModule) | |
.invokeObjCMethod(rt, VoidKind, "testVoid", @selector(testVoid), args, count); | |
} | |
static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_testingNumber(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { | |
return static_cast<ObjCTurboModule &>(turboModule) | |
.invokeObjCMethod(rt, NumberKind, "testingNumber", @selector(testingNumber:), args, count); | |
} | |
static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_testMulti(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { | |
return static_cast<ObjCTurboModule &>(turboModule) | |
.invokeObjCMethod(rt, NumberKind, "testMulti", @selector(testMulti:c:), args, count); | |
} | |
static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_testIdk(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { | |
return static_cast<ObjCTurboModule &>(turboModule) | |
.invokeObjCMethod(rt, VoidKind, "testIdk", @selector(testIdk:), args, count); | |
} | |
static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_testString(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { | |
return static_cast<ObjCTurboModule &>(turboModule) | |
.invokeObjCMethod(rt, StringKind, "testString", @selector(testString:), args, count); | |
} | |
static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_testLotsOfThings(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { | |
return static_cast<ObjCTurboModule &>(turboModule) | |
.invokeObjCMethod(rt, StringKind, "testLotsOfThings", @selector(testLotsOfThings:c:b:), args, count); | |
} | |
NativeTestModuleSpecJSI::NativeTestModuleSpecJSI(id<RCTTurboModule> instance, std::shared_ptr<JSCallInvoker> jsInvoker) | |
: ObjCTurboModule("TestModule", instance, jsInvoker) { | |
methodMap_["testVoid"] = MethodMetadata {0, __hostFunction_NativeTestModuleSpecJSI_testVoid}; | |
methodMap_["testingNumber"] = MethodMetadata {1, __hostFunction_NativeTestModuleSpecJSI_testingNumber}; | |
methodMap_["testMulti"] = MethodMetadata {2, __hostFunction_NativeTestModuleSpecJSI_testMulti}; | |
methodMap_["testIdk"] = MethodMetadata {1, __hostFunction_NativeTestModuleSpecJSI_testIdk}; | |
methodMap_["testString"] = MethodMetadata {1, __hostFunction_NativeTestModuleSpecJSI_testString}; | |
methodMap_["testLotsOfThings"] = MethodMetadata {3, __hostFunction_NativeTestModuleSpecJSI_testLotsOfThings}; | |
} | |
} // namespace react | |
} // namespace facebook | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* RCTTestModule.h | |
* | |
* NOTE: This file is codegenerated. | |
*/ | |
#import <Foundation/Foundation.h> | |
#import "RCTNativeTestModuleSpec.h" | |
@interface RCTTestModule : NSObject<NativeTestModuleSpec> | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* RCTTestModule.mm | |
* | |
* NOTE: This file is codegenerated. | |
*/ | |
#import "RCTTestModule.h" | |
#import <UIKit/UIKit.h> | |
#ifdef RN_TURBO_MODULE_ENABLED | |
using namespace facebook::react; | |
#endif | |
@implementation RCTTestModule | |
// Backward-compatible export | |
RCT_EXPORT_MODULE() | |
@synthesize bridge = _bridge; | |
#ifdef RN_TURBO_MODULE_ENABLED | |
@synthesize turboModuleLookupDelegate = _turboModuleLookupDelegate; | |
#endif | |
#ifdef RN_TURBO_MODULE_ENABLED | |
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModuleWithJsInvoker:(std::shared_ptr<facebook::react::JSCallInvoker>)jsInvoker | |
{ | |
return std::make_shared<NativeTestModuleSpecJSI>(self, jsInvoker); | |
} | |
#endif | |
RCT_EXPORT_METHOD(testVoid) | |
{ | |
// Implement method | |
} | |
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(double, testingNumber:(double)arg) | |
{ | |
// Implement method | |
} | |
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(double, testMulti:(double)arg c:(double)c) | |
{ | |
// Implement method | |
} | |
RCT_EXPORT_METHOD(testIdk:(NSString *)arg) | |
{ | |
// Implement method | |
} | |
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, testString:(NSString *)arg) | |
{ | |
// Implement method | |
} | |
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, testLotsOfThings:(NSString *)arg c:(double)c b:(double)b) | |
{ | |
// Implement method | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment