Merge remote-tracking branch 'origin/master' into broken

Conflicts:
	FRP/FRPGalleryViewController.m
This commit is contained in:
Ash Furrow
2013-10-17 20:36:20 -04:00
2 changed files with 11 additions and 19 deletions

View File

@@ -49,10 +49,15 @@ static NSString *CellIdentifier = @"Cell";
[self.collectionView registerClass:[FRPCell class] forCellWithReuseIdentifier:CellIdentifier];
// Reactive Stuff
RACSignal *photoSignal = [FRPPhotoImporter importPhotos];
RACSignal *noErrors = [photoSignal catch:^RACSignal *(NSError *error) {
NSLog(@"Couldn't fetch photos from 500px: %@", error);
return [RACSignal empty];
}];
RACSignal *photosLoaded = RAC(self, photosArray) = noErrors;
@weakify(self);
[RACObserve(self, photosArray) subscribeNext:^(id x) {
@strongify(self);
[photosLoaded subscribeCompleted:^{
@strongify(self)
[self.collectionView reloadData];
}];
@@ -71,19 +76,6 @@ static NSString *CellIdentifier = @"Cell";
[self.navigationController pushViewController:viewController animated:YES];
}];
self.collectionView.delegate = (id<UICollectionViewDelegate>)collectionViewDelegate;
// Load data
[self loadPopularPhotos];
}
#pragma mark - Private Methods
-(void)loadPopularPhotos {
[[FRPPhotoImporter importPhotos] subscribeNext:^(id x) {
self.photosArray = x;
} error:^(NSError *error) {
NSLog(@"Couldn't fetch photos from 500px: %@", error);
}];
}
#pragma mark - UICollectionViewDataSource Methods

View File

@@ -3,9 +3,9 @@ FunctionalReactivePixels
A demonstration of how to use FRP with ReactiveCocoa in an iOS context using the 500px API.
![](http://cloud.ashfurrow.com/image/0u3W3Y3W470w/Screen%20Shot%202013-10-16%20at%209.42.33%20PM.png)
![](http://static.ashfurrow.com/github/gallery.png)
![](http://cloud.ashfurrow.com/image/1R2j2j3Q0W3i/Screen%20Shot%202013-10-16%20at%209.42.35%20PM.png)
![](http://static.ashfurrow.com/github/photo.png)
Nothing too complicated yet. Next step is a login and vote mechanic to demonstrate more use of `RACSubject` and `RACCommand`. Then I think it'll be done.
@@ -13,4 +13,4 @@ Please don't go all creepy with my consumer key.
Installing
----------------
Clone the repo and run `pod install` from the repo's directory to install the required pods.
Clone the repo and run `pod install` from the repo's directory to install the required pods. Or if you don't like Cocoapods, just [download the zip](http://cloud.ashfurrow.com/013J0y1R3L2l).