-
-
Save gauravds/b9b26f329750ae78ba1ef7c254145822 to your computer and use it in GitHub Desktop.
Objective-C Object Association for JSON Model
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
@interface Model (AdditionalParam) | |
@property (nonatomic, strong) NSString <Optional> * new_key_name; | |
@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
#import "Model+AdditionalParam.h" | |
#import <objc/runtime.h> | |
#define kNew_key_name @"new_key_name" | |
@implementation Card (Keys) | |
- (void)setNew_key_name:(NSString *)value { | |
objc_setAssociatedObject(self, kNew_key_name, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | |
} | |
- (NSString *)new_key_name { | |
return objc_getAssociatedObject(self, kNew_key_name); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment