Skip to content

Instantly share code, notes, and snippets.

@bimawa
Last active August 29, 2015 14:20
Show Gist options
  • Save bimawa/5fff1ca84fbc078068d0 to your computer and use it in GitHub Desktop.
Save bimawa/5fff1ca84fbc078068d0 to your computer and use it in GitHub Desktop.
Handle event of NotificationCenter
@weakify(self);
[[[[[[NSNotificationCenter defaultCenter] rac_addObserverForName:@"NotificationKey"
object:nil] takeUntil:self.rac_willDeallocSignal] filter:^BOOL(NSNotification *notification) {
/*
Validate something for filter
@strongify(self);
NSDictionary *userInfo = notification.userInfo;
return [self.followersViewModel.itemId isEqualToNumber:userInfo[@"itemId"]];
*/
}] deliverOnMainThread] subscribeNext:^(NSNotification *notification) {
/*
BL with data;
NSDictionary *userInfo = notification.userInfo;
cell.followerButton.followerButtonMode = ((NSNumber *) userInfo[@"isFollowed"]).boolValue ? TCFollowersButtonModeFollowed : TCFollowersButtonModeFollow;
*/
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment