Skip to content

Commit

Permalink
CoreData Table Datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Newberry committed Mar 23, 2011
1 parent f634bfd commit 7d3fa1d
Show file tree
Hide file tree
Showing 2 changed files with 472 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/Three20UI/Headers/NSFetchedResultsDataSource.h
@@ -0,0 +1,65 @@
//
// NSFetchedResultsDataSource.h
// Shopify_Mobile
//
// Created by Matt Newberry on 11/15/10.
// Copyright 2010 Shopify. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSFetchedResultsDataSource : TTSectionedDataSource <NSFetchedResultsControllerDelegate>{

NSFetchedResultsController *_fetchedResultsController;
UITableView *_tableView;
NSEntityDescription *_entity;
NSString *_sortBy;
NSArray *_selectFields;
NSString *_sectionKey;
NSPredicate *_predicate;
NSTimer *_updateTimer;
NSInteger _fetchLimit;
NSArray *_relationshipsToFetch;
NSMutableArray *_delegates;

BOOL _isLoading;
BOOL _isOutdated;
BOOL _tableIsUpdating;
NSUInteger sectionInsertCount;
}

@property (nonatomic, assign) BOOL isOutdated;
@property (nonatomic, retain) NSMutableArray *delegates;
@property (nonatomic, assign) BOOL isLoading;
@property (nonatomic, retain) NSArray *relationshipsToFetch;
@property (nonatomic, assign) NSInteger fetchLimit;
@property (nonatomic, retain) NSTimer *updateTimer;
@property (nonatomic, retain) NSPredicate *predicate;
@property (nonatomic, retain) NSString *sectionKey;
@property (nonatomic, retain) NSString *sortBy;
@property (nonatomic, retain) NSArray *selectFields;
@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
@property (nonatomic, retain) NSEntityDescription *entity;

- (id) initWithEntity:(NSEntityDescription *)entity controllerTableView:(UITableView *)controllerTableView;
- (void) loadLocal:(BOOL)more;
- (void) loadRemote;
- (id) cellForObject:(id)object;

- (void) didStartLoad;
- (void) didLoad;
- (void) didFailWithError:(NSError *)error;
- (void) silentDidStartLoad;
- (void) silentDidLoad;

- (NSDate *) loadedTime;
- (NSString*) titleForLoading:(BOOL)reloading;
- (UIImage*) imageForEmpty;
- (NSString*) titleForEmpty;
- (NSString*) subtitleForEmpty;
- (UIImage*) imageForError:(NSError*)error;
- (NSString*) titleForError:(NSError*)error;
- (NSString*) subtitleForError:(NSError*)error;

@end

0 comments on commit 7d3fa1d

Please sign in to comment.