Last active
January 1, 2019 20:30
-
-
Save ryardley/091c98112dfdf57ccf83f0a5e2b69164 to your computer and use it in GitHub Desktop.
Complete implementation bridging to C++
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
// ./ios/ReactBridge/RCTHelloWorld.m | |
#import "RCTHelloWorld.h" | |
#import "HWHelloWorld.h" | |
@implementation RCTHelloWorld{ | |
HWHelloWorld *_cppApi; | |
} | |
- (RCTHelloWorld *)init | |
{ | |
self = [super init]; | |
_cppApi = [HWHelloWorld create]; | |
return self; | |
} | |
+ (BOOL)requiresMainQueueSetup | |
{ | |
return NO; | |
} | |
RCT_EXPORT_MODULE(); | |
RCT_REMAP_METHOD(sayHello, | |
resolver:(RCTPromiseResolveBlock)resolve | |
rejecter:(RCTPromiseRejectBlock)reject) | |
{ | |
NSString *response = [_cppApi getHelloWorld]; | |
resolve(response); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment