mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-21 19:42:59 +08:00
Kill use of delegate on dynamic mapping in favor of blocks and declarative matching
This commit is contained in:
@@ -26,6 +26,9 @@
|
||||
#undef RKLogComponent
|
||||
#define RKLogComponent lcl_cRestKitObjectMapping
|
||||
|
||||
@interface RKDynamicMapping ()
|
||||
@property (nonatomic, strong) NSMutableArray *matchers;
|
||||
@end
|
||||
|
||||
@implementation RKDynamicMapping
|
||||
|
||||
@@ -55,7 +58,7 @@
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_matchers = [NSMutableArray new];
|
||||
self.matchers = [NSMutableArray new];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -84,15 +87,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise consult the delegates
|
||||
if (self.delegate) {
|
||||
mapping = [self.delegate objectMappingForData:data];
|
||||
if (mapping) {
|
||||
RKLogTrace(@"Found dynamic delegate match. Delegate = %@", self.delegate);
|
||||
return mapping;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise consult the block
|
||||
if (self.objectMappingForDataBlock) {
|
||||
mapping = self.objectMappingForDataBlock(data);
|
||||
if (mapping) {
|
||||
|
||||
Reference in New Issue
Block a user