5. Cocoa Binding(Mac Only)
•
The Cocoa bindings technology provides a
means of keeping model and view values
synchronized without you having to write a lot of
“glue code.”(less glue code) It allows you to
establish a mediated connection between a view
and a piece of data, “binding” them such that a
change in one is reflected in the other(reactive).
15. Trigged after a group of
operations completes
[[RACSignal !
merge:@[ [client fetchUserRepos], [client fetchOrgRepos] ]] !
subscribeCompleted:^{!
NSLog(@"They're both done!");!
}];
16. Solves callback hell
[[[[client !
logInUser] !
flattenMap:^(User *user) {!
// Return a signal that loads cached messages for the user.!
return [client loadCachedMessagesForUser:user];!
}]!
flattenMap:^(NSArray *messages) {!
// Return a signal that fetches any remaining messages.!
return [client fetchMessagesAfterMessage:messages.lastObject];!
}]!
subscribeNext:^(NSArray *newMessages) {!
NSLog(@"New messages: %@", newMessages);!
} completed:^{!
NSLog(@"Fetched all messages.");!
}];
17. Advantages
•
RAC is that it provides a single, unified
approach to dealing with asynchronous
behaviors, including delegate methods, callback
blocks, target-action mechanisms, notifications,
and KVO.