Skip to content

Instantly share code, notes, and snippets.

@dayitv89
Forked from sandeepsh3090/Model+AdditionalParam.h
Created December 2, 2016 19:40
Show Gist options
  • Save dayitv89/fffe52ef1b27b8b990c5c3290d19217f to your computer and use it in GitHub Desktop.
Save dayitv89/fffe52ef1b27b8b990c5c3290d19217f 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