Skip to content

Instantly share code, notes, and snippets.

@abbood
Created October 18, 2013 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abbood/7039483 to your computer and use it in GitHub Desktop.
Save abbood/7039483 to your computer and use it in GitHub Desktop.
objective C runtime object associations
//
// UIView+Addons.m
// Breeze
//
// Created by Abdullah Bakhach on 5/15/13.
//
//
#import "NSObject+Addons.h"
#import <objc/runtime.h>
#define kAnimationDuration 0.25f
@implementation NSObject (Addons)
static char infoKey;
-(id)info {
return objc_getAssociatedObject(self, &infoKey);
}
-(void)setInfo:(id)info {
objc_setAssociatedObject(self, &infoKey, info, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment