Skip to content

Instantly share code, notes, and snippets.

@gin0606
Last active December 17, 2015 04:59
Show Gist options
  • Save gin0606/5554288 to your computer and use it in GitHub Desktop.
Save gin0606/5554288 to your computer and use it in GitHub Desktop.
//
// Created by gin0606 on 2013/05/10.
//
#import <Foundation/Foundation.h>
@interface NSMutableArray (NonRetainedObject)
- (void)addNonretainedObject:(id)anObject;
- (id)nonretainedObjectAtIndex:(NSUInteger)index;
@end
//
// Created by gin0606 on 2013/05/10.
//
#import "NSMutableArray+NonRetainedObject.h"
@implementation NSMutableArray (NonRetainedObject)
- (void)addNonretainedObject:(id)anObject {
NSValue *v = [NSValue valueWithNonretainedObject:anObject];
[self addObject:v];
}
- (id)nonretainedObjectAtIndex:(NSUInteger)index {
NSValue *v = [self objectAtIndex:index];
return [v nonretainedObjectValue];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment