Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 27 lines (20 sloc) 0.591 kB
c5a8c81 Wrap associated objects in a nice API
Brent Royal-Gordon authored
1 //
2 // NSObject+AssociatedObject.m
3 // Alef
4 //
5 // Created by Brent Royal-Gordon on 11/11/12.
6 // Copyright (c) 2012 Architechies. All rights reserved.
7 //
8
9 #import "NSObject+AssociatedObject.h"
10 #import <objc/runtime.h>
11
12 @implementation NSObject (AssociatedObject)
13
14 - (id)associatedObjectForKey:(void *)key {
15 return objc_getAssociatedObject(self, key);
16 }
17
18 - (void)setAssociatedObject:(id)object forKey:(void *)key {
19 objc_setAssociatedObject(self, key, object, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
20 }
21
22 - (void)removeAllAssociatedObjects {
23 objc_removeAssociatedObjects(self);
24 }
25
26 @end
Something went wrong with that request. Please try again.