Created
April 22, 2014 13:43
-
-
Save krzysztofzablocki/11179773 to your computer and use it in GitHub Desktop.
Binding lifetime of self to specific object
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
- (void)bindLifetimeToObject:(id)object | |
{ | |
objc_setAssociatedObject(object, (__bridge void *)self, self, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | |
} | |
- (void)releaseLifetimeFromObject:(id)object | |
{ | |
objc_setAssociatedObject(object, (__bridge void *)self, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment