I'm using RestKit for a project and i noticed that there is no longer a method in the class that you can control all mappings in (elementToPropertyMappings), i therefore wondered where the best place to put the new code was, currently i'm doing it in my view controller, but i'll be using most of the same mappings in other areas of my code so is there a more efficient place to put it:
The code i am referring to is:
RKObjectMapping* userMapping = [RKObjectMapping mappingForClass:[User class]];
[userMapping mapKeyPath:@"id" toAttribute:@"identifier"];
[userMapping mapKeyPath:@"forename" toAttribute:@"forename"];
[userMapping mapKeyPath:@"surname" toAttribute:@"surname"];
[userMapping mapKeyPath:@"email" toAttribute:@"email"];
[userMapping mapKeyPath:@"twitter_username" toAttribute:@"twitterUsername"];
[userMapping mapKeyPath:@"created" toAttribute:@"created"];
[userMapping mapKeyPath:@"use_gravatar" toAttribute:@"useGravatar"];
[userMapping mapKeyPath:@"avatar_url" toAttribute:@"avatarURL"];
[userMapping mapKeyPath:@"gender" toAttribute:@"gender"];
[[RKObjectManager sharedManager].mappingProvider setMapping:userMapping forKeyPath:@"user"];
It would be great if this could be in a method on the User class that i can then call to setup these mappings etc.
Many Thanks