Skip to content

Commit

Permalink
ARC Support
Browse files Browse the repository at this point in the history
  • Loading branch information
fousa committed Dec 26, 2011
2 parents 4d484f9 + dc33fd4 commit 5752282
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions NSDictionary+Coby.m
Expand Up @@ -22,7 +22,11 @@ - (NSDictionary *)merge:(NSDictionary *)otherDictionary {
[otherDictionary each: ^(id key, id obj) {
[result setObject:obj forKey:key];
}];
#if __has_feature(objc_arc)
return (NSDictionary *) [result mutableCopy];
#else
return (NSDictionary *) [[result mutableCopy] autorelease];
#endif
}

// The value for each duplicate key is determined by calling the
Expand Down Expand Up @@ -52,7 +56,11 @@ - (NSDictionary *)merge:(NSDictionary *)otherDictionary withBlock:(id (^)(NSStri
[result setObject:obj forKey:key];
}
}];
#if __has_feature(objc_arc)
return (NSDictionary *) [result mutableCopy];
#else
return (NSDictionary *) [[result mutableCopy] autorelease];
#endif
}

// # Fetch
Expand Down
4 changes: 2 additions & 2 deletions NSObject+Coby.m
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>
#import "NSObject+Coby.h"

#import <objc/message.h>

@implementation NSObject (Coby)

Expand All @@ -11,7 +11,7 @@ - (id)send:(NSString *)method {

// Basically an alias for `performSelector:withObject:`
- (id)send:(NSString *)method with:(id)object {
return [self performSelector:NSSelectorFromString(method) withObject:object];
return objc_msgSend(self, NSSelectorFromString(method));
}

// # Try
Expand Down

0 comments on commit 5752282

Please sign in to comment.