Skip to content

Instantly share code, notes, and snippets.

@jparishy
Created July 8, 2013 22:35
Show Gist options
  • Save jparishy/5953074 to your computer and use it in GitHub Desktop.
Save jparishy/5953074 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
typedef void(^FTFetchRequestConfigureBlock)(NSFetchRequest *fetchRequest);
typedef void(^FTFetchRequestCompletion)(NSOrderedSet *results, NSError *error);
typedef void(^FTFetchRequestSingleCompletion)(id model, NSError *error);
@interface FTFetchRequest : NSObject
@property (nonatomic, strong, readonly) NSManagedObjectContext *managedObjectContext;
-(id)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext;
-(BOOL)modelsOfClass:(Class)modelClass fetchRequestBlock:(FTFetchRequestConfigureBlock)fetchRequestBlock completion:(FTFetchRequestCompletion)completion;
-(BOOL)modelsOfClass:(Class)modelClass withPrimaryKeyValues:(NSArray *)values completion:(FTFetchRequestCompletion)completion;
-(BOOL)findOrInsertModelOfClass:(Class)modelClass fetchRequestBlock:(FTFetchRequestConfigureBlock)fetchRequestBlock completion:(FTFetchRequestSingleCompletion)completion;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment