jverkoey/nimbus — Issue #107: Nimbus Photos Library
Author: NukemHill
Created: 2011-11-04 01:02:28+00:00
State: open

Jeff,

I've been hacking at the Photos code, and trying to understand the architecture. I've been swimming in NIToolbarPhotoViewController, and the sample code in NetworkPhotoAlbumViewController and DribbblePhotoAlbumViewController.

My purpose is to build an AlbumViewController that loads image paths from an NSManagedObject, and then pulls the image up from the file system. I might, eventually, make it so that it does either local or network, but I'm not worried about that at the moment.

What I'm finding is that several code chunks in NetworkPhotoAlbumViewController should actually be refactored upwards, either into NIToolbarPhotoViewController, or into a sub-class of that. Aaaaand, actually, I'm beginning to think that a general purpose NIPhotoScrollViewController should be the *parent* of NIToolbarPhotoViewController, and it should manage all of the work not specific to the toolbar/scrubber work done by NIToolbarPVC.

Some of the work that I think should be in NIPhotoScrollViewController:
1) manage _highQualityImageCache and _thumbnailImageCache;
2) - (NSString *)cacheKeyForPhotoIndex:(NSInteger)photoIndex;
3) NIPhotoAlbumScrollView* _photoAlbumView;
4) @property (nonatomic, readonly, retain) NIPhotoAlbumScrollView* photoAlbumView;
5) - (void)loadThumbnails; (currently in DribbblePAVC);
6) - (void)loadAlbumInformation; (which would actually be in the data source identified by this new NIPhotoSVC);

Before I get too deep in the weeds here, I'd like your perspective on what I'm proposing. Especially if I'm missing something fundamental. The main reason I'm suggesting all of this is that I'm finding I need some of these pieces, but they're either buried in the example code sited above, or seemingly inappropriately (again, in my opinion!) in NIToolbarPVC. This refactoring, I think, will allow for easier implementation of sub-classes of the photo viewers in the future, as some of the "heavy lifting" would already be handled.

Thoughts?