dchohfi / KeyValueObjectMapping

Automatic KeyValue Object Mapping for Objective-C, parse JSON/plist/Dictionary automatically
http://dchohfi.com/
MIT License
602 stars 90 forks source link

Typo in code example of Cocoapods documentation #91

Open ManuGira opened 5 years ago

ManuGira commented 5 years ago

In the readme of this github project, we have the following nice and correct example:

DCArrayMapping *mapper = [DCArrayMapping mapperForClassElements:[Tweet class] forAttribute:@"tweets" onClass:[User class]];

But on the website of Cocoapods https://cocoapods.org/pods/DCKeyValueObjectMapping The same code sample is wrong:

DCArrayMapping *mapper = [DCArrayMapping mapperForClassElements: :[Tweet class] forAttribute:@"tweets"] onClass:[User class]];

There is a useless : before [Tweet class] and and a useless ] after @"tweets"

Edit: I just found a new error in both this readme and cocoapods: The following code sample doesn't compile:

DCParserConfiguration *config = [DCParserConfiguration configuration];
[config addArrayMapper:mapper];

DCKeyValueObjectMapping *parser = [[DCKeyValueObjectMapping mapperForClass:[User class] andConfiguration:configuration];
User *user = [parser parseDictionary:jsonParsed];

andConfiguration:configuration must be replaced by andConfiguration:config