RENNotificationCenter是一款非常小巧轻量级的基于NSNotificationCenter
的封装,用于简化iOS开发中的发布订阅模式。
[self.notification rl_subscribe:UIApplicationDidEnterBackgroundNotification block:^(RENEvent *event) {
NSLog(@"eventName = %@",event.name);
}];
[self.notification rl_subscribe:@"CustomEventName" block:^(RENEvent *event) {
NSLog(@"eventName = %@",event.name);
}];
[self.notification rl_publish:@"CustomEventName" userInfo:@"hello"];
[self.notification rl_unsubscribe:@"CustomEventName"];
直接导入源文件。
RENNotificationCenter.h
和RENNotificationCenter.m
本人通过阅读Facebook开源的KVOController源码后,基于其思想实现了RENNotificationCenter
基于MIT协议