Merge branch 'master' into login

This commit is contained in:
Ash Furrow
2013-10-19 09:35:05 -04:00
2 changed files with 10 additions and 8 deletions

View File

@@ -22,8 +22,8 @@
+(RACSignal *)importPhotos {
NSURLRequest *request = [self popularURLRequest];
return [[[[[NSURLConnection rac_sendAsynchronousRequest:request] map:^id(RACTuple *value) {
return [value second];
return [[[[[[NSURLConnection rac_sendAsynchronousRequest:request] reduceEach:^id(NSURLResponse *response, NSData *data){
return data;
}] deliverOn:[RACScheduler mainThreadScheduler]] map:^id(NSData *data) {
id results = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
@@ -35,13 +35,13 @@
return model;
}] array];
}] replay];
}] publish] autoconnect];
}
+(RACSignal *)fetchPhotoDetails:(FRPPhotoModel *)photoModel {
NSURLRequest *request = [self photoURLRequest:photoModel];
return [[[[[NSURLConnection rac_sendAsynchronousRequest:request] map:^id(RACTuple *value) {
return [value second];
return [[[[[[NSURLConnection rac_sendAsynchronousRequest:request] reduceEach:^id(NSURLResponse *response, NSData *data){
return data;
}] deliverOn:[RACScheduler mainThreadScheduler]] map:^id(NSData *data) {
id results = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil][@"photo"];
@@ -49,7 +49,7 @@
[self downloadFullsizedImageForPhotoModel:photoModel];
return photoModel;
}] replay];
}] publish] autoconnect];
}
+(RACSignal *)logInWithUsername:(NSString *)username password:(NSString *)password {
@@ -109,8 +109,8 @@
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];
return [[[NSURLConnection rac_sendAsynchronousRequest:request] map:^id(RACTuple *value) {
return [value second];
return [[[NSURLConnection rac_sendAsynchronousRequest:request] reduceEach:^id(NSURLResponse *response, NSData *data){
return data;
}] deliverOn:[RACScheduler mainThreadScheduler]];
}

View File

@@ -3,6 +3,8 @@ FunctionalReactivePixels
A demonstration of how to use FRP with ReactiveCocoa in an iOS context using the 500px API.
This is code to accompany [my book](https://leanpub.com/iosfrp).
A work-in-progress. Pull-requests always welcome.
![](http://static.ashfurrow.com/github/gallery.png)