I am using mantle for model mapping and overcoat for network request. Overcoat auto map the result to model, but when there is envelope response, I am able to get custom Overcoat response. But problem is the Overcoat response is NSCFDictionary response, but it is supposed to be MantleModel response.
return [RACSignal createSignal: ^RACDisposable *(id<RACSubscriber> subscriber){
[[client rac_GET:@"/services" parameters:@{@"location": @"lat,lng"}] subscribeNext:^( OvercoatResponse *response){
NSArray *res = response.result;//res[0] is _NSCFDictionary object, but it should be MantleModel Object
[subscriber sendNext:res];
} error:^(NSError *error) {
NSLog(@"ERROR: %@", error);
}
];
return nil;
}];
I know how to manually transform the result into mantleModel:
NSArray *mtlnArray = [MTLJSONAdapter modelsOfClass:[MantleModel class] fromJSONArray:response.result error:&error];
But it should be done by overcoat for me. I am curios is there anyway to do it via Overcoat instead of manually transforming the result.