我试图通过NSNotificationCenterObjective-C 发送和接收消息.但是,我还没有找到任何关于如何做到这一点的例子.你如何通过发送和接收消息NSNotificationCenter?
如何在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)