Skip to content

Instantly share code, notes, and snippets.

@sandeepsh3090
Created November 24, 2016 09:23
Show Gist options
  • Save sandeepsh3090/30e6a255bbe6592c930842ecdaae834e to your computer and use it in GitHub Desktop.
Save sandeepsh3090/30e6a255bbe6592c930842ecdaae834e to your computer and use it in GitHub Desktop.
Objective-C Object Association for JSON Model
@interface Model (AdditionalParam)
@property (nonatomic, strong) NSString <Optional> * new_key_name;
@end
#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