Last active
June 18, 2016 20:30
-
-
Save kean/207d95d6d3bb1baa57f914353960166a to your computer and use it in GitHub Desktop.
DFCoreDataMigration.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The MIT License (MIT) | |
// | |
// Copyright (c) 2016 Alexander Grebenyuk (github.com/kean). | |
#import <CoreData/CoreData.h> | |
extern NSString *__nonnull const DFMigrationErrorDomain; | |
typedef NS_ENUM(NSInteger, DFMigrationError) { | |
DFMigrationErrorSourceModelNotFound = 1, | |
DFMigrationErrorMappingModelNotFound = 2, | |
}; | |
@interface DFMigrationManager : NSObject | |
@property (nonnull, nonatomic, copy, readonly) NSURL *storeURL; | |
@property (nonnull, nonatomic, copy, readonly) NSString *storeType; | |
@property (nonnull, nonatomic, copy, readonly) NSArray<NSManagedObjectModel *> *moms; | |
/*! The name of the managed object model configuration used to create the persistent store. Default value is nil. | |
*/ | |
@property (nullable, nonatomic, copy) NSString *storeConfiguraton; | |
/*! Store's options dictionary. Default value is nil. | |
*/ | |
@property (nullable, nonatomic, copy) NSDictionary *storeOptions; | |
/*! Bundles which are used to lookup mapping models. Defaults values in @[[NSBundle mainBundle]] | |
*/ | |
@property (nullable, nonatomic, copy) NSArray<NSBundle *> *bundles; | |
- (nonnull instancetype)initWithStoreURL:(nonnull NSURL *)storeURL storeType:(nonnull NSString *)storeType orderedModels:(nonnull NSArray<NSManagedObjectModel *> *)models NS_DESIGNATED_INITIALIZER; | |
+ (nonnull instancetype)new __attribute__((unavailable("Unavailable"))); | |
- (nonnull instancetype)init __attribute__((unavailable("Unavailable"))); | |
- (BOOL)migrate:(NSError *_Nullable *_Nullable)error; | |
@end | |
@interface DFMigrationManager (Convenience) | |
+ (BOOL)migrateStoreAtURL:(nonnull NSURL *)storeURL storeType:(nonnull NSString *)storeType orderedModels:(nonnull NSArray<NSManagedObjectModel *> *)models error:(NSError *_Nullable *_Nullable)error; | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment