This commit is contained in:
galad87 committed 2015-08-29 13:12:26 +02:00
1 parent bb241f46b1
commit ee94900e33
10 files changed
+56 -67

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
//
// SBLogger.m
// NSArray+Subscripting.h
// Subler
//
+2 -5
View File
@@ -1,5 +1,5 @@
//
// SBLogger.m
// NSArray+Subscripting.m
// Subler
//
@@ -11,9 +11,7 @@
+ (void)load
{
Class class = [self class];
SEL swizzledSelector = @selector(dg_objectAtIndexedSubscript:);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
class_addMethod([NSArray class],
@@ -23,8 +21,7 @@
);
}
- (id)dg_objectAtIndexedSubscript:(NSInteger)index
{
- (id)dg_objectAtIndexedSubscript:(NSInteger)index {
return [self objectAtIndex:index];
}
@@ -1,5 +1,5 @@
//
// SBLogger.m
// NSDictionary+Subscript.h
// Subler
//
@@ -1,5 +1,5 @@
//
// SBLogger.m
// NSDictionary+Subscript.m
// Subler
//
@@ -8,10 +8,8 @@
@implementation NSDictionary (Subscript)
+ (void)load
{
+ (void)load {
Class class = [self class];
SEL swizzledSelector = @selector(dg_objectForKeyedSubscript:);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
@@ -22,8 +20,7 @@
);
}
-(id)dg_objectForKeyedSubscript:(id)key
{
-(id)dg_objectForKeyedSubscript:(id)key {
return [self objectForKey:key];
}
@@ -1,5 +1,5 @@
//
// SBLogger.m
// NSMutableArray+Subscript.h
// Subler
//
@@ -1,5 +1,5 @@
//
// SBLogger.m
// NSMutableArray+Subscript.m
// Subler
//
@@ -11,7 +11,6 @@
+ (void)load
{
Class class = [self class];
SEL swizzledSelector = @selector(dg_setObject:atIndexedSubscript:);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
@@ -22,22 +21,17 @@
);
}
- (void)dg_setObject:(id)anObject atIndexedSubscript:(NSUInteger)index
{
if(anObject == nil)
{
- (void)dg_setObject:(id)anObject atIndexedSubscript:(NSUInteger)index {
if (anObject == nil) {
[NSException raise:NSInvalidArgumentException format:@"setObject:atIndexedSubscript does not allow objects to be nil"];
}
if(index > self.count)
{
if (index > self.count) {
[NSException raise:NSRangeException format:@"setObject:atIndexedSubscript does not allow the index to be out of array bounds"];
}
if(index == self.count)
{
if (index == self.count) {
[self addObject:anObject];
}
else
{
else {
[self replaceObjectAtIndex:index withObject:anObject];
}
}
@@ -1,5 +1,5 @@
//
// SBLogger.m
// NSMutableDictionary+Subscript.h
// Subler
//
@@ -1,5 +1,5 @@
//
// SBLogger.m
// NSMutableDictionary+Subscript.m
// Subler
//
@@ -8,10 +8,8 @@
@implementation NSMutableDictionary (Subscript)
+ (void)load
{
+ (void)load {
Class class = [self class];
SEL swizzledSelector = @selector(dg_setObject:forKeyedSubscript:);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
@@ -22,8 +20,7 @@
);
}
- (void)dg_setObject:(id)object forKeyedSubscript:(id < NSCopying >)aKey
{
- (void)dg_setObject:(id)object forKeyedSubscript:(id < NSCopying >)aKey {
[self setObject:object forKey:aKey];
}