Migrated away from RACTuple as view model model.

This commit is contained in:
Ash Furrow
2013-10-25 19:10:05 -04:00
parent d9d6382f4b
commit c1bac58dbf
4 changed files with 19 additions and 16 deletions

View File

@@ -11,31 +11,34 @@
// Model
#import "FRPPhotoModel.h"
@interface FRPFullSizePhotoViewModel ()
// Private access
@property (nonatomic, assign) NSInteger initialPhotoIndex;
@end
@implementation FRPFullSizePhotoViewModel
-(instancetype)initWithPhotoArray:(NSArray *)photoArray initialPhotoIndex:(NSInteger)initialPhotoIndex {
self = [self initWithModel:photoArray];
if (!self) return nil;
self.initialPhotoIndex = initialPhotoIndex;
return self;
}
-(NSString *)initialPhotoName {
return [self.photoArray[self.initialPhotoIndex] photoName];
}
-(NSInteger)initialPhotoIndex {
return [self.model.second integerValue];
}
-(NSArray *)photoArray {
return self.model.first;
return [self.model[self.initialPhotoIndex] photoName];
}
-(FRPPhotoModel *)photoModelAtIndex:(NSInteger)index {
if (index < 0 || index > self.photoArray.count - 1) {
if (index < 0 || index > self.model.count - 1) {
// Index was out of bounds, return nil
return nil;
} else {
return self.photoArray[index];
return self.model[index];
}
}