如何在Swift中将事件发送到JavaScript?
有一些Objc代码示例如何将事件发送到JavaScript,但我需要在swift中做什么?
#import "RCTBridge.h"
#import "RCTEventDispatcher.h"
@implementation CalendarManager
@synthesize bridge = _bridge;
- (void)calendarEventReminderReceived:(NSNotification *)notification
{
NSString *eventName = notification.userInfo[@"name"];
[self.bridge.eventDispatcher sendAppEventWithName:@"EventReminder"
body:@{@"name": eventName}];
}
@end
Run Code Online (Sandbox Code Playgroud)