[ad_1]
It is really described in fairly a element right here.
- First you create an Goal-C bridge to catch occasions from Swift.
- Then in Goal-C once more, you implement an
RCTEventEmitter(may be similar or totally different class) That is the category that can ship occasions to JS. The occasions are despatched utilizingsendEventWithNameoperate
Here is a really tough sketch:
Step 1: catch Swift occasions
@interface MyBridge() <SomeDelegate>
@finish
@implementation MyBridge
// Here is my delegate operate:
- (void)myDelegateCalled
// Obtained an occasion
// Calling bridge to ship the occasion to JS
BridgeEventEmitter ship:someData
...
Step 2: ship them to JS
// Here is the BridgeEventEmitter:
@interface BridgeEventEmitter : RCTEventEmitter <RCTBridgeModule>
@finish
@implementation BridgeEventEmitter
+ (void)ship:(NSString *)one thing
{
[self sendEventWithName:@"EventName" body:something];
}
[ad_2]
