A look at krzysztofzablocki/PropertyMapper: 1.1k stars on GitHub, written primarily in Objective-C. Property mapping for Objective-C iOS apps.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Stop repeating your data parsing code in iOS apps.
Data parsing is one of most common tasks we need to do in our apps, yet still majority of people do this parsing by hand, always repeating the same code for each class they need to map.
Usual parsing requires this steps:
make sure you translate NSNull to nil and not crash
gracefully handle optional params
do type conversions
data format validation
Why Property Mapper?
There are libraries helping with that like Mantle, RESTKit and many more… But I wanted something that's self contained, easy to change / remove and requires minimal amount of code.
I've created Property Mapper as part of working on Foldify, a simple self contained solution that allows you to specify mapping between data you receive and data representation you have in your application... with some additional features, like type boxing, validation.
I don't like passing around JSON so I write parsing on top of native objects like NSDictionary/NSArray.
If you get data as JSON just write a simple category that transforms JSON to native objects using NSJSONSerialization.
Quite obvious what it does but in case you are confused, it will translate videoURL string to contentURL NSURL object, it will also grab title from sub_object and assign it to uniqueID. It also handles NSNull.
Advanced usage
Let's now change our mind and decide that we want our type property to be typedef enumeration, it's quite easy with KZPropertyMapper, change type mapping to following and add following method:
@"videoType" : KZCall(videoTypeFromString:, type),
//! implemented on instance you are parsing
- (id)videoTypeFromString:(NSString *)type
{
if ([type isEqualToString:@"shortVideo"]) {
return @(VideoTypeShort);
}
return @(VideoTypeLong);
}
If you need property name being passed while using selectors, just pass two-argument selector in KZCall. Second argument will be property name passed as NSString.
@"video" : KZCall(objectFromDictionary:forPropertyName:, type),
//! implemented on instance you are parsing
- (id)objectFromDictionary:(NSDictionary *)dictionary forPropertyName:(NSString *)propertyName
{
Class objectClass = [self classForProperty:propertyName];
id object = [objectClass new];
[object updateFromDictionary:dictionary];
return object;
}
Done. KVC should also take care of escaping NSNumber into int if your property uses primitive type. Same approach will work for sub-object instances or anything that you can assign to property.
Validations
You can also validate your server data before mapping it:
Does krzysztofzablocki/PropertyMapper have any tags?
TopGit's last sync did not record any GitHub topics for krzysztofzablocki/PropertyMapper. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on krzysztofzablocki/PropertyMapper?
The most recent commit recorded on krzysztofzablocki/PropertyMapper was 5.9 years ago, based on the GitHub push timestamp. The repository has 79 forks — one of the better signals of community interest.
How many stars does krzysztofzablocki/PropertyMapper have?
krzysztofzablocki/PropertyMapper has 1.1k GitHub stars — refresh the page for the live number, or check github.com/krzysztofzablocki/PropertyMapper. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is krzysztofzablocki/PropertyMapper?
krzysztofzablocki/PropertyMapper (krzysztofzablocki/PropertyMapper) is a Objective-C project on GitHub. From the project's own README: Property mapping for Objective-C iOS apps.
What language is krzysztofzablocki/PropertyMapper written in?
krzysztofzablocki/PropertyMapper is written primarily in Objective-C. GitHub's language field is based on the largest share of bytes in the default branch.
Read full README in the tab above.
Still deciding about PropertyMapper?
One click hands the question to an AI along with this page — see what it says about PropertyMapper.