Last active
August 29, 2015 14:20
-
-
Save bimawa/5fff1ca84fbc078068d0 to your computer and use it in GitHub Desktop.
Handle event of NotificationCenter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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