Last active
December 15, 2015 15:48
-
-
Save azu/5283951 to your computer and use it in GitHub Desktop.
mogenerator --base-class BasedManagedObject
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
// | |
// Created by azu on 12/11/19. | |
// | |
#import <Foundation/Foundation.h> | |
@interface BasedManagedObject : NSManagedObject | |
@property(nonatomic, strong) NSString *identifier; | |
@end |
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
// | |
// Created by azu on 12/11/19. | |
// | |
#import "BasedManagedObject.h" | |
@implementation BasedManagedObject { | |
} | |
@synthesize identifier = _identifier; | |
- (void)awakeFromInsert { | |
[super awakeFromInsert]; | |
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); | |
NSString *uuidStr = (__bridge_transfer NSString *) CFUUIDCreateString(kCFAllocatorDefault, uuid); | |
CFRelease((CFTypeRef) uuid); | |
self.identifier = uuidStr; | |
} | |
@end |
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
mogenerator -m HOGE/HOGE.xcdatamodeld/ -O HOGE/App/Models \ | |
--template-var arc=true \ | |
--base-class BasedManagedObject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment